|
|
@@ -1,12 +1,12 @@
|
|
|
<template>
|
|
|
<!-- 采购: 历史敞口-->
|
|
|
<div class="purchase-history">
|
|
|
- <div class="chart-main" id="main"></div>
|
|
|
+ <div ref="chart" class="chart-main" id="main"></div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts">
|
|
|
-import { defineComponent, onMounted } from 'vue';
|
|
|
+import { defineComponent, onMounted, ref } from 'vue';
|
|
|
import { initData } from '@/common/methods';
|
|
|
import * as echarts from 'echarts/core';
|
|
|
import {
|
|
|
@@ -34,14 +34,13 @@ export default defineComponent({
|
|
|
name: 'purchase-history',
|
|
|
components: {},
|
|
|
setup() {
|
|
|
+ const chart = ref();
|
|
|
const option = {
|
|
|
xAxis: {
|
|
|
type: 'category',
|
|
|
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
|
|
|
},
|
|
|
- yAxis: {
|
|
|
- type: 'value',
|
|
|
- },
|
|
|
+ yAxis: {},
|
|
|
series: [
|
|
|
{
|
|
|
data: [820, 932, 901, 934, 1290, 1330, 1320],
|
|
|
@@ -51,14 +50,18 @@ export default defineComponent({
|
|
|
],
|
|
|
};
|
|
|
onMounted(() => {
|
|
|
- const ele = document.getElementById('main') as HTMLElement;
|
|
|
- const myChart = echarts.init(ele);
|
|
|
- myChart.setOption(option);
|
|
|
+ setTimeout(() => {
|
|
|
+ const ele = chart.value as HTMLElement;
|
|
|
+ const myChart = echarts.init(ele);
|
|
|
+ myChart.setOption(option);
|
|
|
+ }, 0);
|
|
|
});
|
|
|
initData(() => {
|
|
|
option;
|
|
|
});
|
|
|
- return {};
|
|
|
+ return {
|
|
|
+ chart,
|
|
|
+ };
|
|
|
},
|
|
|
});
|
|
|
</script>
|