如何获取dom?
固然是咱们的refs方法啦
有两种具体的使用方法
第一种:使用this.$refs.绑定咱们设置的名字,放在methods里获取
第二种:使用e.target方法dom
具体事例:this
<div class=“a” ref=“ok”>a</div> <script>里的methods methods:{ a:function(){ var getOk = this.$refs.ok.innerText; console.log(getOk);//a } 另一种 methods:{ a:function(0{ var el = e.target; console.log(el); //<div class=“a” >a</div> }