From 3995aca5c4a5742de96891f78c057370bf8e22ae Mon Sep 17 00:00:00 2001 From: catchonme Date: Fri, 16 Aug 2019 17:37:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=AA=8C=E8=AF=81Carousel?= =?UTF-8?q?=E4=B8=ADoptions=E6=98=AF=E5=90=A6=E6=94=B9=E5=8F=98=E7=9A=84?= =?UTF-8?q?=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderers/Carousel.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/renderers/Carousel.tsx b/src/renderers/Carousel.tsx index bb2b63b4b..5bf695b51 100644 --- a/src/renderers/Carousel.tsx +++ b/src/renderers/Carousel.tsx @@ -2,7 +2,7 @@ import React from 'react'; import Transition, {ENTERED, ENTERING, EXITING} from 'react-transition-group/Transition'; import {Renderer, RendererProps} from '../factory'; import {resolveVariable} from '../utils/tpl-builtin'; -import {autobind, createObject, isObject} from '../utils/helper'; +import {autobind, createObject, isObject, isArrayChilrenModified} from '../utils/helper'; import {leftArrowIcon, rightArrowIcon} from '../components/icons'; const animationStyles: { @@ -91,7 +91,7 @@ export class Carousel extends React.Component { componentWillReceiveProps(nextProps:CarouselProps) { const currentOptions = this.state.options; const nextOptions = nextProps.value || nextProps.options || resolveVariable(nextProps.name, nextProps.data) || []; - if (JSON.stringify(currentOptions) !== JSON.stringify(nextOptions)) { + if (isArrayChilrenModified(currentOptions, nextOptions)) { this.setState({ options: nextOptions });