|
|
@@ -4,7 +4,7 @@ import type { EchartsProps } from './echarts';
|
|
|
import Echarts from './echarts';
|
|
|
import Style from './index.less';
|
|
|
import classNames from 'classnames';
|
|
|
-import React, { forwardRef } from 'react';
|
|
|
+import React, { forwardRef, useEffect, useState } from 'react';
|
|
|
|
|
|
interface BaseCardProps extends HeaderProps, EchartsProps {
|
|
|
height: number;
|
|
|
@@ -15,6 +15,12 @@ interface BaseCardProps extends HeaderProps, EchartsProps {
|
|
|
export default forwardRef((props: BaseCardProps, ref) => {
|
|
|
const { height, className, options, ...formProps } = props;
|
|
|
|
|
|
+ const [myOptions, setMyOptions] = useState(options);
|
|
|
+
|
|
|
+ useEffect(() => {
|
|
|
+ console.log('myOptions-change');
|
|
|
+ setMyOptions(options);
|
|
|
+ }, [options]);
|
|
|
return (
|
|
|
<div
|
|
|
className={classNames(Style['dash-board'], className)}
|
|
|
@@ -24,7 +30,7 @@ export default forwardRef((props: BaseCardProps, ref) => {
|
|
|
>
|
|
|
<Header ref={ref} {...formProps} />
|
|
|
<div className={Style['echarts-content']}>
|
|
|
- <Echarts options={options} className={Style['echarts']} />
|
|
|
+ <Echarts options={myOptions} className={Style['echarts']} />
|
|
|
{props.echartsAfter}
|
|
|
</div>
|
|
|
</div>
|