Преглед на файлове

refactor: 优化drawer抽屉弹窗的高度代码

lanjianrong преди 5 години
родител
ревизия
53498bb879
променени са 2 файла, в които са добавени 13 реда и са изтрити 9 реда
  1. 5 6
      src/components/PopContent/Contacts/index.jsx
  2. 8 3
      src/components/PopContent/index.scss

+ 5 - 6
src/components/PopContent/Contacts/index.jsx

@@ -5,15 +5,14 @@ import ContanctForm from '@/components/PopContent/Contacts/ContanctForm.jsx'
 import ContanctTabList from '@/components/PopContent/Contacts/ContanctTabList.jsx'
 import ContanctTabList from '@/components/PopContent/Contacts/ContanctTabList.jsx'
 import ContanctLowerList from '@/components/PopContent/Contacts/ContanctLowerList.jsx'
 import ContanctLowerList from '@/components/PopContent/Contacts/ContanctLowerList.jsx'
 import { apiContactDetail } from '@/services/contact'
 import { apiContactDetail } from '@/services/contact'
-import useAutoTable from '@/hooks/useAutoTable'
 import consts from '@/consts'
 import consts from '@/consts'
 import { connect } from 'dva'
 import { connect } from 'dva'
 
 
 const Popcontent = props => {
 const Popcontent = props => {
-  const { dispatch, shouldUpdate, visible, onClose, collapsed, id = '' } = props
-  const needSubtractHeight = 55 // 需要被裁掉的高度
+  const { dispatch, shouldUpdate, visible, onClose, id = '' } = props
+  // const needSubtractHeight = 55 // 需要被裁掉的高度
   // const needSubtractWidth = (collapsed ? 208 : 48) + 48 + 48 + 48 // 需要被裁掉的高度
   // const needSubtractWidth = (collapsed ? 208 : 48) + 48 + 48 + 48 // 需要被裁掉的高度
-  const [x, y] = useAutoTable(collapsed, needSubtractHeight)
+  // const [x, y] = useAutoTable(collapsed, needSubtractHeight)
 
 
   // 浏览器实际宽度
   // 浏览器实际宽度
   const [clientWidth, setClientWidth] = useState(document.body.clientWidth * 0.75)
   const [clientWidth, setClientWidth] = useState(document.body.clientWidth * 0.75)
@@ -56,7 +55,7 @@ const Popcontent = props => {
           title="联系人"
           title="联系人"
           placement="right"
           placement="right"
           bodyStyle={{
           bodyStyle={{
-            height: y,
+            height: '100vh',
             overflowY: 'hidden'
             overflowY: 'hidden'
           }}
           }}
           width={clientWidth}
           width={clientWidth}
@@ -66,7 +65,7 @@ const Popcontent = props => {
           // mask={false}
           // mask={false}
         >
         >
           <Row>
           <Row>
-            <Col span={12} className="sheet-box-left" style={{ height: y - 25, overflowY: 'auto' }}>
+            <Col span={12} className="sheet-box-left">
               <div className="sheet-left-panel zh-pd-right-15">
               <div className="sheet-left-panel zh-pd-right-15">
                 <ContanctForm client={state.client} />
                 <ContanctForm client={state.client} />
               </div>
               </div>

+ 8 - 3
src/components/PopContent/index.scss

@@ -1,9 +1,14 @@
 // 弹窗左右结构
 // 弹窗左右结构
 .sheet-box {
 .sheet-box {
   overflow: hidden;
   overflow: hidden;
-}
-.sheet-left-panel {
-  overflow-x: hidden;
+  .sheet-box-left {
+    height: calc(100vh - 25px);
+    overflow-y: auto;
+    .sheet-left-panel {
+      overflow-x: hidden;
+    }
+
+  }
 }
 }
 .sheet-right-panel {
 .sheet-right-panel {
   height: 280px;
   height: 280px;