<template>
// option 通过id行绑定
<div id="myRangChart" style="width: 100%;height:300px;">
</div>
</template>
<script setup>
// option 引入全部
import * as echarts from "echarts"
import { onMounted, ref, watch } from "vue"
// 默认加载
onMounted(() => {
setTimeout(() => {
//一秒后加载
initRang()
}, 1000)
})
const initRang = () => {
// 绑定id
let myRangChart = echarts.init(document.getElementById("myRangChart"));
myRangChart.setOption({
// option中的值;
})
window.onresize = function () { // 自适应大小
myRangChart.resize();
};
}
</script>
<style lang="scss" scoped>
</style>