<template>
<div>
<p>{{count}}</p>
<button @click="setCountHandler">按钮</button>
<a :href="url">百度</a>
<p v-for="(item,index) in names" :key="index">{{item}}</p>
<button @click="addNames">按钮</button>
</div>
</template>
<script>
export default {
name: "APIDemo1",
data(){
return{
count:10,
url:"http://www.baidu.com",
names:["a","b","c","d"]
}
},
methods:{
setCountHandler(){
this.count+=1
},
addNames(){
let currentName = ["e","f"];
let totalNames = this.name.concat(currentName);
this.names = totalNames;
}
}
}
</script>
这是 this.count
