mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-02 15:27:18 +00:00
feat: $ method
This commit is contained in:
parent
877d3fccc6
commit
cf502929af
@ -57,6 +57,7 @@ export default class BaseEngine extends Component {
|
|||||||
super(props, context);
|
super(props, context);
|
||||||
this.appHelper = props.__appHelper;
|
this.appHelper = props.__appHelper;
|
||||||
this.__compScopes = {};
|
this.__compScopes = {};
|
||||||
|
this.__instanceMap = {};
|
||||||
const { locale, messages } = props;
|
const { locale, messages } = props;
|
||||||
this.i18n = generateI18n(locale, messages);
|
this.i18n = generateI18n(locale, messages);
|
||||||
this.__bindCustomMethods(props);
|
this.__bindCustomMethods(props);
|
||||||
@ -312,6 +313,7 @@ export default class BaseEngine extends Component {
|
|||||||
Comp = compWrapper(Comp);
|
Comp = compWrapper(Comp);
|
||||||
}
|
}
|
||||||
otherProps.ref = (ref) => {
|
otherProps.ref = (ref) => {
|
||||||
|
this.$(props.fieldId, 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;
|
||||||
@ -526,6 +528,17 @@ export default class BaseEngine extends Component {
|
|||||||
return checkProps(props);
|
return checkProps(props);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$(filedId, instance) {
|
||||||
|
this.__instanceMap = this.__instanceMap || {};
|
||||||
|
if (!filedId) {
|
||||||
|
return this.__instanceMap;
|
||||||
|
}
|
||||||
|
if (instance) {
|
||||||
|
this.__instanceMap[filedId] = instance;
|
||||||
|
}
|
||||||
|
return this.__instanceMap[filedId];
|
||||||
|
}
|
||||||
|
|
||||||
get utils() {
|
get utils() {
|
||||||
return this.appHelper && this.appHelper.utils;
|
return this.appHelper && this.appHelper.utils;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user