mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-02-28 21:20:28 +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);
|
||||
this.appHelper = props.__appHelper;
|
||||
this.__compScopes = {};
|
||||
this.__instanceMap = {};
|
||||
const { locale, messages } = props;
|
||||
this.i18n = generateI18n(locale, messages);
|
||||
this.__bindCustomMethods(props);
|
||||
@ -312,6 +313,7 @@ export default class BaseEngine extends Component {
|
||||
Comp = compWrapper(Comp);
|
||||
}
|
||||
otherProps.ref = (ref) => {
|
||||
this.$(props.fieldId, ref); // 收集ref
|
||||
const refProps = props.ref;
|
||||
if (refProps && typeof refProps === 'string') {
|
||||
this[refProps] = ref;
|
||||
@ -526,6 +528,17 @@ export default class BaseEngine extends Component {
|
||||
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() {
|
||||
return this.appHelper && this.appHelper.utils;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user