Loading

vue通过ref获取dom节点

HTML在任意节点上添加属性“ref”

<span ref="span_01">span_01</span>
<button @click="consoleDOM()">consoleDOM</button>

SCRIPT vue里通过 this.$refs.xxx 获取

consoleDOM() {
  window.console.log(this.$refs.span_01)
}
posted @ 2020-01-28 16:17  mahoshojo  阅读(1774)  评论(0编辑  收藏  举报