实现步骤 使用ref函数传入null,创建ref对象 setup(){ const hRef=ref(null) } 模板中通过定义ref属性 等于1中创建的ref对象名称建立关联 <button ref="hRef">按钮</button>