From a4ef35bb323b5f8300f15a4eb604d61ff39a194a Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 17 十二月 2020 17:35:39 +0800
Subject: [PATCH] 2020-12-17

---
 src/tabviews/custom/components/card/prop-card/index.jsx |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/tabviews/custom/components/card/prop-card/index.jsx b/src/tabviews/custom/components/card/prop-card/index.jsx
index 1e01bd4..f072388 100644
--- a/src/tabviews/custom/components/card/prop-card/index.jsx
+++ b/src/tabviews/custom/components/card/prop-card/index.jsx
@@ -64,7 +64,9 @@
       _cols.set(item.field, item)
     })
 
+    let _width = 0
     _config.subcards.forEach(card => {
+      _width += card.setting.width
       card.elements = card.elements.map(item => {
         if (item.field && _cols.has(item.field)) {
           item.col = _cols.get(item.field)
@@ -78,6 +80,15 @@
         return item
       })
     })
+
+    let offset = 0
+    if (_config.wrap.cardFloat && _config.wrap.cardFloat !== 'left' && _config.subcards[0] && _width < 24) {
+      offset = 24 - _width
+      if (_config.wrap.cardFloat === 'center') {
+        offset = Math.floor(offset / 2)
+      }
+      _config.subcards[0].offset = offset
+    }
 
     this.setState({
       sync: _sync,
@@ -252,9 +263,9 @@
             <Spin />
           </div> : null
         }
-        <div className="card-row-list">
+        <div className={`card-row-list ${config.wrap.cardType} ${config.wrap.scale}`}>
           {config.subcards.map((item, index) => (
-            <Col className={activeKey === index ? 'active' : ''} key={index} span={item.setting.width || 6} onClick={() => {this.changeCard(index, item)}}>
+            <Col className={activeKey === index ? 'active' : ''} key={index} span={item.setting.width || 6} offset={item.offset || 0} onClick={() => {this.changeCard(index, item)}}>
               <CardItem card={item} cards={config} data={data} updateStatus={this.updateStatus}/>
             </Col>
           ))}

--
Gitblit v1.8.0