fix: tslint error

This commit is contained in:
thinkinggis 2020-02-12 10:06:24 +08:00
parent 5b42f2d7b3
commit 5e442daa9e
4 changed files with 15 additions and 13 deletions

View File

@ -19,5 +19,6 @@ exports.onCreateWebpackConfig = ({ getConfig }) => {
'@antv/l7-scene': path.resolve(__dirname, 'packages/scene/src'), '@antv/l7-scene': path.resolve(__dirname, 'packages/scene/src'),
'@antv/l7-source': path.resolve(__dirname, 'packages/source/src'), '@antv/l7-source': path.resolve(__dirname, 'packages/source/src'),
'@antv/l7-utils': path.resolve(__dirname, 'packages/utils/src'), '@antv/l7-utils': path.resolve(__dirname, 'packages/utils/src'),
'@antv/l7-react': path.resolve(__dirname, 'packages/react/src')
}; };
}; };

View File

@ -9,13 +9,10 @@ interface ILayerProps {
} }
export default React.memo(function Chart(props: ILayerProps) { export default React.memo(function Chart(props: ILayerProps) {
const { layer, scales } = props; const { layer, scales } = props;
useEffect( useEffect(() => {
() => {
scales.field scales.field
? layer.scale(scales.field as string, scales.value as IScale) ? layer.scale(scales.field as string, scales.value as IScale)
: layer.scale(scales.values as IScaleOptions); : layer.scale(scales.values as IScaleOptions);
}, }, [scales.value, scales.field, JSON.stringify(scales.values)]);
Object.values(scales).map((scale) => JSON.stringify(scales)),
);
return null; return null;
}); });

View File

@ -9,8 +9,11 @@ interface ILayerProps {
} }
export default React.memo(function Chart(props: ILayerProps) { export default React.memo(function Chart(props: ILayerProps) {
const { layer, style } = props; const { layer, style } = props;
useEffect(() => { useEffect(
() => {
layer.style(style); layer.style(style);
}, Object.values(style)); },
Object.keys(style).map((key) => style[key]),
);
return null; return null;
}); });

View File

@ -3,7 +3,8 @@
"compilerOptions": { "compilerOptions": {
"declarationDir": "./es", "declarationDir": "./es",
"rootDir": "./src", "rootDir": "./src",
"baseUrl": "./" "baseUrl": "./",
"target": "es6",
}, },
"include": ["./src"] "include": ["./src"]
} }