vue3 $refs 的使用方法

 

// 第一步:<template> 组件上挂载 ref
<van-form ref="$form"></van-form>
// 第二步:获取 “this” const currentInstance = getCurrentInstance() // 第三步:获取 form 对象 const $form = currentInstance?.refs?.$form

 

posted @ 2022-12-07 09:18  贝尔塔猫  阅读(798)  评论(0)    收藏  举报