mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-03 04:28:32 +08:00
修改验证Carousel中options是否改变的方式
This commit is contained in:
parent
03762d14ad
commit
3995aca5c4
@ -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<CarouselProps, CarouselState> {
|
||||
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
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user