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>"
});
浙公网安备 33010602011771号