<div id="app">
<h2>透過 emit 向外傳遞資訊</h2>
我透過元件儲值了 {{ cash }} 元
<button @click="incrementTotal" class="btn btn-primary">click</button>
<button-counter></button-counter>
<hr>
<button-counter></button-counter>
</div>
var app = new Vue({
el: '#app',
data: {
cash: 300
},
methods: {
incrementTotal() {
this.cash += 1
}
}
});