UNPKG

cione-comp-lib

Version:

`$ yarn add cione-comp-lib` 或者 `$ npm i cione-comp-lib -S`

71 lines (70 loc) 2.34 kB
import { defineComponent, ref, onMounted, toRefs, h, markRaw } from "vue"; import * as index from "../../node_modules/echarts/index.mjs"; import "../../node_modules/echarts-gl/lib/echarts-gl.mjs"; import "../../node_modules/echarts-gl/lib/component/grid3D.mjs"; import "../../node_modules/echarts-gl/lib/component/geo3D.mjs"; import "../../node_modules/echarts-gl/lib/component/globe.mjs"; import "../../node_modules/echarts-gl/lib/component/mapbox3D.mjs"; import "../../node_modules/echarts-gl/lib/component/maptalks3D.mjs"; import "../../node_modules/echarts-gl/lib/chart/bar3D.mjs"; import "../../node_modules/echarts-gl/lib/chart/line3D.mjs"; import "../../node_modules/echarts-gl/lib/chart/scatter3D.mjs"; import "../../node_modules/echarts-gl/lib/chart/lines3D.mjs"; import "../../node_modules/echarts-gl/lib/chart/polygons3D.mjs"; import "../../node_modules/echarts-gl/lib/chart/surface.mjs"; import "../../node_modules/echarts-gl/lib/chart/map3D.mjs"; import "../../node_modules/echarts-gl/lib/chart/scatterGL.mjs"; import "../../node_modules/echarts-gl/lib/chart/graphGL.mjs"; import "../../node_modules/echarts-gl/lib/chart/flowGL.mjs"; import "../../node_modules/echarts-gl/lib/chart/linesGL.mjs"; import { init } from "../../node_modules/echarts/lib/core/echarts.mjs"; const _sfc_main = defineComponent({ props: { code: { type: String } }, setup(props) { const dom = ref(); const chart = ref(); const option = ref(); const init$1 = () => { try { window.echarts = window.echarts || index; chart.value = markRaw(init(dom.value)); const fn = Function(` var option; ${props.code} return option; `); option.value = fn(); chart.value.setOption(option.value); } catch (e) { console.log(e, "co-user-defined-collection echarts init"); } }; const RESET_VIEW = () => { var _a; (_a = chart.value) == null ? void 0 : _a.resize(option.value); }; onMounted(() => { init$1(); }); return { dom, ...toRefs(props), RESET_VIEW }; }, render() { return h("div", { ref: "dom", class: "co-user-defined-echarts", style: { width: "100%", height: "100%" } }); } }); export { _sfc_main as default };