update pay function
This commit is contained in:
@@ -9,12 +9,19 @@ import * as echarts from 'echarts';
|
||||
* ECharts 图表渲染组件
|
||||
* @param {Object} option - ECharts 配置对象
|
||||
* @param {number} height - 图表高度(默认 400px)
|
||||
* @param {string} variant - 主题变体: 'light' | 'dark' | 'auto' (默认 auto)
|
||||
*/
|
||||
export const EChartsRenderer = ({ option, height = 400 }) => {
|
||||
export const EChartsRenderer = ({ option, height = 400, variant = 'auto' }) => {
|
||||
const chartRef = useRef(null);
|
||||
const chartInstance = useRef(null);
|
||||
const bgColor = useColorModeValue('white', 'gray.800');
|
||||
const isDarkMode = useColorModeValue(false, true);
|
||||
|
||||
// 系统颜色模式
|
||||
const systemBgColor = useColorModeValue('white', 'transparent');
|
||||
const systemIsDark = useColorModeValue(false, true);
|
||||
|
||||
// 根据 variant 决定实际使用的模式
|
||||
const isDarkMode = variant === 'dark' ? true : variant === 'light' ? false : systemIsDark;
|
||||
const bgColor = variant === 'dark' ? 'transparent' : variant === 'light' ? 'white' : systemBgColor;
|
||||
|
||||
useEffect(() => {
|
||||
if (!chartRef.current || !option) return;
|
||||
@@ -62,7 +69,7 @@ export const EChartsRenderer = ({ option, height = 400 }) => {
|
||||
window.removeEventListener('resize', handleResize);
|
||||
// chartInstance.current?.dispose(); // 不要销毁,避免重新渲染时闪烁
|
||||
};
|
||||
}, [option, isDarkMode]);
|
||||
}, [option, isDarkMode, variant]);
|
||||
|
||||
// 组件卸载时销毁图表
|
||||
useEffect(() => {
|
||||
|
||||
Reference in New Issue
Block a user