vue-test -----ListDemo 列表渲染
<template>
<h3>数组</h3>
<button @click="addnums">添加数据</button>
<p v-for="(item,index) in nums" :key="index">{{item}}</p>
</template>
<script>
export default {
name: "ListDemo",
data(){
return{
nums:["li","jia","yao"]
}
},
methods:{
addnums(){
//this.nums.push("lin")
this.nums.concat("zhang")
console.log(this.nums.concat("zhang"))
}
}
}
</script>
<style scoped>
</style>