更新
This commit is contained in:
@ -3,7 +3,7 @@
|
||||
</template>
|
||||
<script setup>
|
||||
import * as echarts from "echarts";
|
||||
import { onMounted, ref, reactive, defineProps, onUnmounted, watch, nextTick } from "vue";
|
||||
import { onMounted, ref, defineEmits, defineProps, onUnmounted, watch, nextTick } from "vue";
|
||||
const props = defineProps({
|
||||
echartsId: {
|
||||
type: String,
|
||||
@ -14,6 +14,7 @@ const props = defineProps({
|
||||
default: () => { }
|
||||
}
|
||||
});
|
||||
const emit = defineEmits(['click']);
|
||||
|
||||
// 保存echarts实例
|
||||
const myChart = ref(null);
|
||||
@ -136,9 +137,11 @@ function chartFn() {
|
||||
},
|
||||
axisTick: {
|
||||
show: true
|
||||
}, axisLabel: {
|
||||
interval: 0 // 控制标签的显示间隔,0 表示全部显示,可以根据需要调整为其他值,例如 1 表示每隔一个显示一个标签。
|
||||
}
|
||||
},
|
||||
axisLabel: {
|
||||
interval: 1, // 控制标签的显示间隔,0 表示全部显示,可以根据需要调整为其他值,例如 1 表示每隔一个显示一个标签。
|
||||
color: '#666666'
|
||||
}
|
||||
},
|
||||
yAxis: {
|
||||
type: "value",
|
||||
@ -208,6 +211,9 @@ function chartFn() {
|
||||
};
|
||||
|
||||
option && myChart.value.setOption(option);
|
||||
myChart.value.on('click', function (param) {
|
||||
emit('click', param.name);
|
||||
});
|
||||
}
|
||||
|
||||
// 监听数据变化
|
||||
|
||||
Reference in New Issue
Block a user