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)
}
原文地址:https://www.cnblogs.com/mahoshojo/p/12238301.html
时间: 2024-10-09 00:24:50