$refs实现组件通信
可以获取并操作DOM、组件对象
使用方法:
<button @click="handleFn">按钮</button>
handleFn() {
在元素上面绑定事件,然后找到元素
console.log(this.$refs);
let { 元素, yuansu1 } = this.$refs //接住元素
yuansu1.style.border='1px solid red' //设置元素样式
}
$refs实现组件通信
可以获取并操作DOM、组件对象
使用方法:
<button @click="handleFn">按钮</button>
handleFn() {
在元素上面绑定事件,然后找到元素
console.log(this.$refs);
let { 元素, yuansu1 } = this.$refs //接住元素
yuansu1.style.border='1px solid red' //设置元素样式
}