ref是vue中提供的直接操作dom的方法
<div v-for = ‘item in list‘>{{item}}</div>
<input type="text" value="请输入内容" ref = ‘inp‘ @focus=‘clear‘>
<button @click= ‘click()‘>提交</button>
click:function(){ let i = this.$refs.inp.value console.log(i); this.list.push(i) // console.log(e); }
原文:https://www.cnblogs.com/libainian/p/13216624.html