import { ref as a, reactive as o, computed as i, watch as p, onMounted as l, openBlock as u, createElementBlock as d } from "vue";
import { i as s } from "./echarts.js";
const m = {
  __name: "index",
  props: {
    option: {
      type: Object,
      default: () => ({})
    }
  },
  setup(r) {
    const n = r, e = a(), t = o({
      defaultOption: {
        xAxis: {
          type: "category",
          data: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
        },
        yAxis: {
          type: "value"
        },
        series: [
          {
            data: [120, 200, 150, 80, 70, 110, 130],
            type: "bar"
          }
        ]
      },
      //默认的配置项
      finallyOption: i(() => ({
        ...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 = s(e.value), t.renderChart();
    }), (c, f) => (u(), d("div", {
      ref_key: "divRef",
      ref: e,
      style: { height: "100%" }
    }, null, 512));
  }
};
export {
  m as default
};
