VueJs学习随笔--组件化
·
大约 800 个字
·
预计 4
分钟 读完
组件基础
组件是可复用的 Vue 实例, 每个组件都有一个名字,我们可以直接使用名字来引入一个组件。
定义一个名为 button-counter 的新组件:
1
2
3
4
5
6
7
8
| Vue.component('button-counter', {
data: function () {
return {
count: 0
}
},
template: '<button v-on:click="count++">You clicked me {{ count }} times.</button>'
})
|
阅读更多