From 4751cbd63d9f24ab2aaa5c5930a7aca0263471c0 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 19 四月 2021 23:36:51 +0800 Subject: [PATCH] 2021-04-19 --- src/mob/mobshell/card.jsx | 40 +++++++++++++++++++++++----------------- 1 files changed, 23 insertions(+), 17 deletions(-) diff --git a/src/mob/mobshell/card.jsx b/src/mob/mobshell/card.jsx index 3a2a1fa..47eb3c6 100644 --- a/src/mob/mobshell/card.jsx +++ b/src/mob/mobshell/card.jsx @@ -18,6 +18,7 @@ const NormalGroup = asyncComponent(() => import('@/menu/components/group/normal-group')) const CodeSandbox = asyncComponent(() => import('@/menu/components/code/sandbox')) const NormalLogin = asyncComponent(() => import('@/pc/components/login/normal-login')) +const NormalNavbar = asyncComponent(() => import('@/mob/components/navbar/normal-navbar')) const Card = ({ id, card, moveCard, findCard, delCard, updateConfig }) => { const originalIndex = findCard(id).index @@ -52,6 +53,25 @@ style = { opacity: 0.3} } + let col = 'ant-col-' + (card.width || 24) + if (card.type === 'navbar') { + col = '' + } else if (card.type === 'login') { + let height = '' + if (card.wrap && card.wrap.height) { + // scaleview + height = card.wrap.height.replace(/\d+vw/ig, (word) => { + return parseFloat(word) * 420 / 100 + 'px' + // return parseFloat(word) * 350 / 100 + 'px' + }).replace(/\d+vh/ig, (word) => { + return parseFloat(word) * 738 / 100 + 'px' + // return parseFloat(word) * 615 / 100 + 'px' + }) + } + + style.minHeight = height + } + const getCardComponent = () => { if (card.type === 'bar' || card.type === 'line') { return (<AntvBar card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) @@ -81,27 +101,13 @@ return (<CodeSandbox card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) } else if (card.type === 'login') { return (<NormalLogin card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) + } else if (card.type === 'navbar') { + return (<NormalNavbar card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) } - } - - if (card.type === 'login') { - let height = '' - if (card.wrap && card.wrap.height) { - // scaleview - height = card.wrap.height.replace(/\d+vw/ig, (word) => { - return parseFloat(word) * 420 / 100 + 'px' - // return parseFloat(word) * 350 / 100 + 'px' - }).replace(/\d+vh/ig, (word) => { - return parseFloat(word) * 738 / 100 + 'px' - // return parseFloat(word) * 615 / 100 + 'px' - }) - } - - style.minHeight = height } return ( - <div className={'ant-col mk-component-card ant-col-' + (card.width || 24)} ref={node => drag(drop(node))} style={style}> + <div className={'ant-col mk-component-card ' + col} ref={node => drag(drop(node))} style={style}> {getCardComponent()} </div> ) -- Gitblit v1.8.0