feat: 支持获取组件引用的提案

This commit is contained in:
wuyue.xht 2021-04-22 11:20:47 +08:00
parent e371092952
commit f0d2d56910

View File

@ -464,7 +464,7 @@ export default function baseRenererFactory() {
Comp = compWrapper(Comp); Comp = compWrapper(Comp);
} }
otherProps.ref = (ref: any) => { otherProps.ref = (ref: any) => {
this.$(props.fieldId, ref); // 收集ref this.$(props.fieldId || props.ref, ref); // 收集ref
const refProps = props.ref; const refProps = props.ref;
if (refProps && typeof refProps === 'string') { if (refProps && typeof refProps === 'string') {
this[refProps] = ref; this[refProps] = ref;
@ -691,7 +691,7 @@ export default function baseRenererFactory() {
$(filedId: string, instance?: any) { $(filedId: string, instance?: any) {
this.__instanceMap = this.__instanceMap || {}; this.__instanceMap = this.__instanceMap || {};
if (!filedId) { if (!filedId || typeof filedId !== 'string') {
return this.__instanceMap; return this.__instanceMap;
} }
if (instance) { if (instance) {