Vue 组件要点

 1、子组件 需要用 is 的地方:

<tbody>
    <tr is='newComponent'></tr>
</tbody>

<ul>
    <li is='newComponent'></li>
</ul>

<ol>
    <li is='newComponent'></li>
</ol>

<select>
    <option is='newComponent'></option>
</select>

2、子组件定义的 data  必须是一个 function,并返回一个对象。

Vue.component('newComponent',{
    "data": function(){
         return  {
             "content":"hello,world!"
         };
    },
    "template":"<div>{{content}}</div>"
});

 

posted on 2018-05-03 09:24  HB1  阅读(183)  评论(0)    收藏  举报

导航