<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);
}
}
});
添加数据时如何去掉 {{ list.name }} 显示的前后空格?
http://jsfiddle.net/znsepcyo/3/