omii-ui
Version:
使用OMII开发的WebComponents库,样式采用bootstrap。可以作为标准的esmodule使用
59 lines (55 loc) • 1.18 kB
JSX
const { h, classNames, extractClass } = omii;
import uiBase from "../uiBase";
import css from "./index.scss";
let root = new URL(`./echarts/`, import.meta.url).href;
let jsFile = "echarts.esm.min.js";
let ECharts = null;
export default class extends uiBase {
static css = css;
static propTypes = {};
static defaultProps = {
title: null,
tooltip: null,
legend: [],
xAxis: null,
yAxis: null,
series: [],
width: null,
height: null,
};
static get root() {
return root;
}
static set root(value) {
root = value;
}
static get jsFile() {
return jsFile;
}
static set jsFile(value) {
jsFile = value;
}
#echart;
get echart() {
return this.#echart;
}
async installed() {
let echarts = ECharts;
if (!echarts) {
echarts = ECharts = await import(
new URL(this.constructor.jsFile, this.constructor.root).href
);
}
this.#echart = echarts.init(this.$("main"));
this.draw();
}
draw() {
this.echart.setOption(this.$props);
}
updated() {
this.draw();
}
render() {
return <main />;
}
}