写法粗糙,只是为了自己工作时方便查看
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<div id="app">
<span>{{count}}</span>
<button @click="inc">+</button>
</div>
<script>
var app = new Vue({
// 1.
// data () {
// return {count: 0}
// },
// 2.
// data: {
// count: 0
// },
// 3.
data: function() {
return {
count: 0
}
},
methods: {
inc () {this.count++}
}
})
app.$mount(‘#app‘)
</script>
原文地址:https://www.cnblogs.com/gaonac/p/10747114.html
时间: 2024-10-28 02:35:45