vuejs / jsx-vue2

monorepo for Babel / Vue JSX related packages
https://jsx-vue2-playground.netlify.app/
1.47k stars 96 forks source link

无法在vue2.7的中使用ref获取dom,以及组件实例。 #288

Open jetBn opened 1 year ago

jetBn commented 1 year ago
image image
jetBn commented 1 year ago

image

nooooooom commented 1 year ago

如果需要手动赋值 ref 的话,使用函数的形式赋值

<SwitchSettingCommonModal ref="(el)=>{modalRef.value = el}" />
i-ce-fish commented 7 months ago

如果需要手动赋值 ref 的话,使用函数的形式赋值

<SwitchSettingCommonModal ref="(el)=>{modalRef.value = el}" />

可行的, 不过实例代码应该是这样<SwitchSettingCommonModal ref={el=>(modalRef.value = el)} />