移動端H5開發填坑
阿新 • • 發佈:2019-04-04
absolut col :after auto fixed 動態修改 position 定位 網上
1.0.5像素邊框
由於UI的樣式要求,在項目中所有的線全部都得是0.5像素,所以在網上找到了一個比較好用的寫法,就是比較麻煩
.best3_title{ height: 48px; font-size: 14px; font-weight: bold; color: #000000; line-height: 48px; margin: 0 16px; position: relative;/* 本體必加屬性 */ } .best3_title:after{ position: absolute; left: 0; right: 0; content: ""; display: block; bottom: 0; border-bottom: 1px solid #e7e7e7;/*你需要的線*/ transform: scaleY(0.5);/* 當線是橫線時使用Y如果是豎線則需要改成X*/ width: 100%; }
2.關於Vue項目中自己用div拼成的select
在使用div+ul+li拼出當前的select時需要註意,一般UI會要求在下拉候選項出來的 時候出現蒙層,並保持下層部分無法滾動,經過多次試驗,需要將蒙層定位設置為fixed鋪滿屏幕,其次將蒙層下內容區使用overflow:hidden截取並設置高度為100vh在內容區有margin的情況則需要同時設置margin為0代碼如下:
(1)蒙層樣式:
.flow_all{ position: fixed; top: 0; left: 0; height: 100vh; width: 100%; z-index:998; background: #333; opacity: 0.4; }
(2)js修改動態修改
//顯示蒙層時 document.getElementById(‘region_report‘).style.height=‘100vh‘; document.getElementById(‘region_report‘).style.marginBottom=‘0px‘ document.getElementById(‘region_report‘).style.overflowY=‘hidden‘; //蒙層消失時 document.getElementById(‘region_report‘).style.height=‘auto‘ document.getElementById(‘region_report‘).style.marginBottom=‘44px‘ document.getElementById(‘region_report‘).style.overflowY=‘scroll‘;
3.使用固定line-heigh在移動端上會有偏差,需要手動去調整(初次遇到,也可能是未知部分影響)
(未完待續)
移動端H5開發填坑