zz-chart
Version:
Alauda Chart components by Alauda Frontend Team
34 lines • 900 B
JavaScript
import { getComponent, getComponentNames } from '../components/index.js';
/**
* view strategy 视图策略抽象类
* 规范 strategy 的实现
*/
export class ViewStrategy {
constructor(view) {
// 存储当前策略下实力化的组件
this.components = [];
// 全局配置的组件
this.usedComponent = getComponentNames();
this.ctrl = view;
this.initComponent();
this.init();
}
get options() {
return this.ctrl.getOption();
}
/**
* 根据当前策略初始化组件
*/
initComponent() {
for (const name of this.component) {
const Component = getComponent(name);
if (Component) {
this.components.push(new Component(this.ctrl));
}
}
}
destroy() {
this.components = [];
}
}
//# sourceMappingURL=abstract.js.map