first commit

This commit is contained in:
zjc
2024-12-12 10:30:11 +08:00
commit 81d7983cb6
37 changed files with 5240 additions and 0 deletions

27
src/directive/index.js Normal file
View File

@@ -0,0 +1,27 @@
// directives.js
import { onMounted, onUnmounted } from 'vue';
import * as echarts from 'echarts';
export const useEchartsResize = (el) => {
let chartInstance = null;
const createChart = () => {
chartInstance = echarts.init(el);
};
const resizeChart = () => {
if (chartInstance) {
chartInstance.resize();
}
};
onMounted(() => {
createChart();
window.addEventListener('resize', resizeChart);
});
onUnmounted(() => {
window.removeEventListener('resize', resizeChart);
chartInstance && chartInstance.dispose();
});
};