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

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

操作:

this.$refs.test.innerHTML = "test"           //js操作;操作元素的方法
this.$refs.sub.$el = "test" //js操作;操作组件的方法

相关文章:

  • 2022-12-23
  • 2021-09-27
  • 2022-12-23
  • 2022-12-23
  • 2022-01-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-07-07
  • 2022-12-23
  • 2022-12-23
  • 2021-07-23
  • 2021-10-11
相关资源
相似解决方案