Vue对于dom的操作

Vue中有时候我们还是需要直接操作DOM的,,只需要在标签上加上$refs就可以直接操作

<button ref="test">test</button>

操作:

this.$refs.test.innerHTML = "test"           //js操作;操作元素的方法
this.$refs.sub.$el = "test" //js操作;操作组件的方法
原文地址:https://www.cnblogs.com/ash-sky/p/9772934.html