From 3695086fe9a23043dddd40068380ee22bfcd9056 Mon Sep 17 00:00:00 2001 From: RUNZE LU <36724300+lurunze1226@users.noreply.github.com> Date: Mon, 27 Dec 2021 18:46:57 +0800 Subject: [PATCH] =?UTF-8?q?fix=20#3262:=20Card=E7=BB=84=E4=BB=B6media.url?= =?UTF-8?q?=E4=B8=8D=E6=94=AF=E6=8C=81=E5=8F=98=E9=87=8F=20(#3279)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderers/Card.tsx | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/renderers/Card.tsx b/src/renderers/Card.tsx index 843842621..011259be8 100644 --- a/src/renderers/Card.tsx +++ b/src/renderers/Card.tsx @@ -4,7 +4,7 @@ import {SchemaNode, Schema, Action, PlainObject} from '../types'; import {filter, evalExpression} from '../utils/tpl'; import Checkbox from '../components/Checkbox'; import {padArr, isVisible, isDisabled, noop, hashCode} from '../utils/helper'; -import {resolveVariable} from '../utils/tpl-builtin'; +import {resolveVariable, resolveVariableAndFilter} from '../utils/tpl-builtin'; import QuickEdit, {SchemaQuickEdit} from './QuickEdit'; import PopOver, {SchemaPopOver} from './PopOver'; import {TableCell} from './Table'; @@ -644,15 +644,19 @@ export class CardRenderer extends React.Component { } renderMedia() { - const {media, classnames: cx, render, region} = this.props; + const {media, classnames: cx, render, region, data} = this.props; if (media) { const {type, url, className, autoPlay, isLive, poster} = media; + const mediaUrl = resolveVariableAndFilter(url, data, '| raw'); - if (type === 'image' && url) { + if (type === 'image' && mediaUrl) { return ( - + ); - } else if (type === 'video' && url) { + } else if (type === 'video' && mediaUrl) { return (
{ @@ -660,7 +664,7 @@ export class CardRenderer extends React.Component { type: type, autoPlay: autoPlay, poster: poster, - src: url, + src: mediaUrl, isLive: isLive }) as JSX.Element }