javascript - vue组件传值props的问题
PHPz
PHPz 2017-04-11 13:05:58
0
1
339
     Examples     
    

{{uiname}}


我这样运行结果是子组件

{{hyname}}

为NAN,控制套提示[Vue warn]: Attribute ":zj-name" is ignored on component because the component is a fragment instance: http://vuejs.org/guide/compon...,,难道是我props用的不对?代码可能有点乱,抱歉。谢谢各位帮忙说下是不是错的很离谱。

PHPz
PHPz

学习是最好的投资!

Antworte allen (1)
阿神

写法有问题,把

data:function(){ return{ zjName:"io", } }, props:['zjName']

放到上面
变成

var childVal = Vue.extend({ template:'#childVal', data:function(){ return{ zjName:"io", } }, props:['zjName'] });

还有就是你已经在data里定义了zjName,应该换个名称

    Neueste Downloads
    Mehr>
    Web-Effekte
    Quellcode der Website
    Website-Materialien
    Frontend-Vorlage
    Über uns Haftungsausschluss Sitemap
    Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!