app.vue
商品
评论
商家
export default {
name: 'app',
data () {
return {
seller: {}
}
},
created () {
this.$http.get('/api/seller').then((res) => {
if (res.body.errno === ERR_OK) {
this.seller = res.body.data
}
}, () => {
})
},
components: {
'v-header': header
}
}
goods.vue
export default {
props: {
seller: {
type: Object
}
},
created () {
console.log(this.seller) // seller 为空对象
}
}
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
vue得后台数据是异步的,可以在路由用if判断是不是已经得到数据.
我理解有误, props 参数传递成功了, 只是异步的数据还没回来.
你怎么解决这个问题,我也遇到了