if判斷語句這樣寫合理嗎 為什么感覺這樣寫很low呢<input type="text" v-model="name"><button @click="add">提交</button>data () { return {
name:'',
user:[]
}
},
methods: {
add () { if (this.user.length > 5){
alert('長度過長') return false
} this.user.push(this.name) this.name = ''
}
}關注 | 5收藏
添加回答
舉報
0/150
提交
取消