vue组件内读取组件内定义的数据

xiaoxiao2021-02-28  22

Vue.component('tab-home', { data:function(){ return { a:{id:"home-tab-a", text:"home-tab-a text"}, b:{id:"home-tab-b", text:"home-tab-b text"} } }, template: ` <div>

<span>Home component</span>

                                <!-- $data就是data:function(){}返回的数据-->

<button v-for="tb in $data">{{tb.text}}</button> </div> ` });
转载请注明原文地址: https://www.6miu.com/read-2629336.html

最新回复(0)