多个组件
<comp1 :ref="setRef" name="comp1"/>
<comp2 :ref="setRef" name="comp2"/>
设置ref
const refs = new Map();
const setRef = (el) => {
refs.set(el.$attrs['name'], el);
};
多个组件
<comp1 :ref="setRef" name="comp1"/>
<comp2 :ref="setRef" name="comp2"/>
设置ref
const refs = new Map();
const setRef = (el) => {
refs.set(el.$attrs['name'], el);
};