From 2f39ea2148dfb173d782eb6b76ca7adefd72eba9 Mon Sep 17 00:00:00 2001 From: catchonme Date: Thu, 11 Jul 2019 19:33:32 +0800 Subject: [PATCH] =?UTF-8?q?audio=20=E6=94=AF=E6=8C=81src=E5=8F=96=E5=8F=98?= =?UTF-8?q?=E9=87=8F=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scss/components/_carousel.scss | 6 ++++-- src/renderers/Audio.tsx | 10 +++++++--- src/renderers/Carousel.tsx | 3 +-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/scss/components/_carousel.scss b/scss/components/_carousel.scss index 39bd2d20..406f5fd0 100644 --- a/scss/components/_carousel.scss +++ b/scss/components/_carousel.scss @@ -17,6 +17,8 @@ } .#{$ns}Carousel { + min-width: $Carousel-minWidth; + height: $Carousel-height; position: relative; display: block; background: $Carousel-bg; @@ -56,8 +58,8 @@ } &-container { - min-width: $Carousel-minWidth; - height: $Carousel-height; + width: 100%; + height: 100%; position: relative; overflow: hidden; diff --git a/src/renderers/Audio.tsx b/src/renderers/Audio.tsx index 3bb90f2c..6617773e 100644 --- a/src/renderers/Audio.tsx +++ b/src/renderers/Audio.tsx @@ -4,6 +4,7 @@ import {Renderer, RendererProps} from '../factory'; import {autobind} from '../utils/helper'; import {volumeIcon, muteIcon, playIcon, pauseIcon} from '../components/icons'; import {resolveVariable} from '../utils/tpl-builtin'; +import {filter} from '../utils/tpl'; export interface AudioProps extends RendererProps { className?: string; @@ -49,7 +50,7 @@ export class Audio extends React.Component { }; state: AudioState = { - src: this.props.value || this.props.src || resolveVariable(this.props.name, this.props.data) || '', + src: this.props.value || (this.props.src ? filter(this.props.src, this.props.data) : '') || resolveVariable(this.props.name, this.props.data) || '', isReady: false, muted: false, playing: false, @@ -82,9 +83,12 @@ export class Audio extends React.Component { componentWillReceiveProps(nextProps:AudioProps) { const props = this.props; - if (props.value !== nextProps.value || props.src !== nextProps.src) { + if ( + props.value !== nextProps.value || + filter(props.src as string, props.data) !== filter(nextProps.src as string, nextProps.data) + ) { this.setState({ - src: nextProps.value || nextProps.src, + src: nextProps.value || filter(nextProps.src as string, nextProps.data), playing: false }, () => { this.audio.load(); diff --git a/src/renderers/Carousel.tsx b/src/renderers/Carousel.tsx index 4e5fb882..316d0850 100644 --- a/src/renderers/Carousel.tsx +++ b/src/renderers/Carousel.tsx @@ -262,7 +262,6 @@ export class Carousel extends React.Component { className={cx('Carousel-container')} onMouseEnter={this.handleMouseEnter} onMouseLeave={this.handleMouseLeave} - style={carouselStyles} > {options.map((option:any, key:number) => ( { } return ( -
+
{body ? body : placeholder}
);