扫码关注官方订阅号
vue-router中怎么用props传值啊
认证高级PHP讲师
<router-view :x=x></router-view>',var Bar = Vue.extend({ template: '
This is bar!
应该好看撒
用vue router的话你应该用params来传值
props传值?传父组件?传子组件?子传父看下这个:http://vuejs.org.cn/guide/components.htm...父子组件通信父传子(props)大概就是:子Ab.vue定一个字段如:
props: { megs: String }
父B.vue就给值:
data() { return { message: 'hei' } }
然后父引入子组件并绑在子组件上:
<ab :megs = "message"></ab>
大概就是这样,看文档吧,可以解决很多问题
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
<router-view :x=x></router-view>',
var Bar = Vue.extend({
template: '
This is bar!
{{x}}',props:['x'],
})
这里是关键
应该好看撒
用vue router的话你应该用params来传值
props传值?传父组件?传子组件?
子传父看下这个:http://vuejs.org.cn/guide/components.htm...父子组件通信
父传子(props)大概就是:
子Ab.vue定一个字段如:
父B.vue就给值:
然后父引入子组件并绑在子组件上:
大概就是这样,看文档吧,可以解决很多问题