为了账号安全,请及时绑定邮箱和手机立即绑定

vue.js 三层父子组件通信

vue.js 三层父子组件通信

暴躁的代码 2017-06-05 22:19:02
new Vue({//爷爷 el:"#example-2",           components: {     'u-component':  {//儿子 template: '<div><mini-child v-bind:display="display" v-bind:message="message"></mini-child>A custom component!</div>',    data:{    display:true,    message:"Message in parent"    }, components:{    "mini-child": {//孙子 template:'<div>一个孙子<p v-if="display">!!!!</p>{{message}}</div>', props:["display","message"] }    } } } })vue.js:435 [Vue warn]: The "data" option should be a function that returns a per-instance value in component definitions.warn @ vue.js:435 vue.js:435 [Vue warn]: Property or method "display" is not defined on the instance but referenced during render. Make sure to declare reactive data properties in the data option. found in ---> <UComponent>        <Root>warn @ vue.js:435 vue.js:435 [Vue warn]: Property or method "message" is not defined on the instance but referenced during render. Make sure to declare reactive data properties in the data option. found in ---> <UComponent>        <Root>求帮帮,这个是什么问题呢?
查看完整描述

1 回答

?
暴躁的代码

TA贡献7条经验 获得超10个赞

.....data必须是个函数

查看完整回答
反对 回复 2017-06-05
  • 1 回答
  • 0 关注
  • 3631 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信