fix: 🐛 小程序里面不支持可选链 "?.", 先直接访问 dataSourceEngine 吧

This commit is contained in:
牧毅 2020-08-12 16:52:26 +08:00
parent eba172ce51
commit 36c486b9cd
2 changed files with 6 additions and 8 deletions

View File

@ -11,7 +11,7 @@ import { RAX_CHUNK_NAME } from './const';
type PluginConfig = { type PluginConfig = {
fileType: string; fileType: string;
} };
const pluginFactory: BuilderComponentPluginFactory<PluginConfig> = (config?) => { const pluginFactory: BuilderComponentPluginFactory<PluginConfig> = (config?) => {
const cfg: PluginConfig = { const cfg: PluginConfig = {
@ -50,10 +50,10 @@ const pluginFactory: BuilderComponentPluginFactory<PluginConfig> = (config?) =>
self.setState(newState); self.setState(newState);
}, },
get dataSourceMap() { get dataSourceMap() {
return self._dataSourceEngine?.dataSourceMap || {}; return self._dataSourceEngine.dataSourceMap || {};
}, },
async reloadDataSource() { async reloadDataSource() {
self._dataSourceEngine?.reloadDataSource(); self._dataSourceEngine.reloadDataSource();
}, },
get utils() { get utils() {
return self._utils; return self._utils;
@ -72,9 +72,7 @@ const pluginFactory: BuilderComponentPluginFactory<PluginConfig> = (config?) =>
return context; return context;
} }
`, `,
linkAfter: [ linkAfter: [RAX_CHUNK_NAME.ClassRenderEnd],
RAX_CHUNK_NAME.ClassRenderEnd
],
}); });
return next; return next;

View File

@ -39,10 +39,10 @@ class Home$$Page extends Component {
self.setState(newState); self.setState(newState);
}, },
get dataSourceMap() { get dataSourceMap() {
return self._dataSourceEngine?.dataSourceMap || {}; return self._dataSourceEngine.dataSourceMap || {};
}, },
async reloadDataSource() { async reloadDataSource() {
self._dataSourceEngine?.reloadDataSource(); self._dataSourceEngine.reloadDataSource();
}, },
get utils() { get utils() {
return self._utils; return self._utils;