import { ref as a, reactive as i, computed as o, watch as p, onMounted as l, openBlock as s, createElementBlock as d } from "vue";
import { i as f } from "./echarts.js";
const y = {
  __name: "index",
  props: {
    option: {
      type: Object,
      default: () => ({})
    }
  },
  setup(r) {
    const n = r, e = a(), t = i({
      defaultOption: {
        title: {
          text: "ECharts 入门示例"
        },
        tooltip: {},
        xAxis: {
          data: ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"]
        },
        yAxis: {},
        series: [
          {
            name: "销量",
            type: "bar",
            data: [5, 20, 36, 10, 10, 20]
          }
        ]
      },
      //默认的配置项
      finallyOption: o(() => ({
        ...t.defaultOption,
        ...n.option
      })),
      //与传入配置Object.assign()之后的最终配置项
      myChart: null,
      renderChart: () => {
        t.myChart && t.myChart.setOption(t.finallyOption);
      }
      //渲染函数
    });
    return p(() => t.finallyOption, () => {
      t.renderChart();
    }, { deep: !0 }), l(() => {
      t.myChart = f(e.value), t.renderChart();
    }), (c, u) => (s(), d("div", {
      ref_key: "divRef",
      ref: e,
      style: { height: "100%" }
    }, null, 512));
  }
};
export {
  y as default
};
