实现步骤
- 使用ref函数传入null,创建ref对象
setup(){
const hRef=ref(null)
}
- 模板中通过定义ref属性 等于1中创建的ref对象名称建立关联
<button ref="hRef">按钮</button>
实现步骤
setup(){
const hRef=ref(null)
}
<button ref="hRef">按钮</button>
道可道,非常道;名可名,非常名。 无名,天地之始,有名,万物之母。 故常无欲,以观其妙,常有欲,以观其徼。 此两者,同出而异名,同谓之玄,玄之又玄,众妙之门。