vue学习(五)组件
其他
2019-01-13 03:25:18
阅读次数: 0
1.简单案例
<div id="components-demo">
<button-counter></button-counter>
</div>
|
new Vue({ el: '#components-demo' }) |
// 定义一个名为 button-counter 的新组件
Vue.component('button-counter', {
data: function () {
return {
count: 0
}
},
template: '<button v-on:click="count++">You clicked me {{ count }} times.</button>'
}) |
转载自blog.csdn.net/qq_34874784/article/details/85638321