Blogger Information
Blog 5
fans 0
comment 0
visits 3727
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
Vue 计数器的实现
P粉536129282
Original
801 people have browsed it

目录
1、计数器的实现
2、实现效果

1、计数器的实现
在页面上简单实现一个计数器:
`<!DOCTYPE html>

<html lang="en">

<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="../js/vue.js"></script>
</head>

<body>

<div id="app">
<h3>当前计数器:{{counter}}</h3>
<button @click="add">+</button>
<button @click="minutes">-</button>
</div>

<script>
const app = new Vue({
el: “#app”,
data: {
counter: 0
},
methods: {
add: function () {
this.counter++;
},
minutes: function () {
this.counter—;
}
}
})
</script>
</body>
</html>`
2、实现效果
最后实现的效果,看gif图:

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post