vue.js 添加数据时怎么去掉input内容里的前后空格
1个回答
展开全部
<input type="text" v-model="list.name" v-on:keyup.enter="addList">
<template v-for="list in lists">
{{ list.name }}
</template>
var data = {
list : { name: '', age: '' },
lists: []
},
vm = new Vue({
el: '#content',
data: data,
methods: {
addList: function(){
this.lists.push(this.list);
}
}
<template v-for="list in lists">
{{ list.name }}
</template>
var data = {
list : { name: '', age: '' },
lists: []
},
vm = new Vue({
el: '#content',
data: data,
methods: {
addList: function(){
this.lists.push(this.list);
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询