<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div id="div">
<div>{{two}} </div>
<ul>
<li v-for="item in one">{{item}}</li>
</ul>
<button v-on:click='three++'>+</button><div style="display: inline-block; width: 20px; height: 20px; border: 1px solid black;">{{three}}</div>
<button v-on:click='three--' style="margin: -5px;">-</button>
</div>
</body>
</html>
<script src="vue.js"></script>
<script>
const div=new Vue({
el:'#div',
data:{
one:['q','sl','d','f','g','hhh'],
two:'你是仙女',
three:0
},
})
</script>
vue v-for v-on 计数按钮
最新推荐文章于 2022-12-29 17:07:00 发布