Note: Self-resolved
<!DOCTYPE html>
<html lang="ja">
<head>
<metacharset="UTF-8">
<title>My Vue.js Practice</title>
</head>
<body>
<divid="myCounter">
<div>{{count}}</div>
<button v-on:click="count++">Up</button>
</div>
<script src="./js/vue.js"></script>
<script>
varvm = new Vue({
el: '#myCounter',
data: {
count—0
},
methods: {
countUp: function(){
this.count++;
}
}
});
</script>
</body>
</html>
I made a counter after looking at the sample.
How do I install multiple counters in a page so that each value works together?
I think there are other ways, but
If you only want to display the same value,
Simply place multiple <divid="myCounter">
under the same
I think this is a simple and easy way to realize it.
It's okay to "stretch far".
<divid="myCounter">
<div>{{count}}</div>
<button v-on:click="count++">Up</button>
<div>
Additional content <br/>
That <br/>
<br/>
<br/> in between
</div>
<div>{{count}}</div>
<button v-on:click="count++">Up</button>
</div>
544 PHP ssh2_scp_send fails to send files as intended
543 Understanding How to Configure Google API Key
524 Uncaught (inpromise) Error on Electron: An object could not be cloned
546 Who developed the "avformat-59.dll" that comes with FFmpeg?
678 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
© 2024 OneMinuteCode. All rights reserved.