weex czzlm 項目開發總結--重構

WEEX重構存在問題與解決方案css

一、不能支持橫屏
二、native不支持less內嵌(.header . hd_back{})、@import寫法
三、native 不支持樣式屬性簡寫:好比不支持padding: 10px 5px 0px 0px; 必須寫成android

padding-top: 10px; padding-right: 5px; 才能生效

四、不要使用 background 簡寫.
五、<image> 設置padding和 width 生成效果H五、android不一致,須要把padding修改爲margin
六、ios 不支持line-height,得統一使用padding-top
七、native 不支持before、after等僞元素
八、native div默認是inline 須要用display: flex;
九、H5 使用了flex: 1; 高度(1px)不會auto。得設置display: block;
十、native在設置position: absolute; 不支持width百分比, 統一用750px就是100%
十一、native 設置display: flex; height,致使padding、margin不生效。得去掉height。
十二、底部對齊兩個不一樣元素的文字,必須給兩個文字設置高度ios

clipboard.png

clipboard.png

1三、native a組件不能直接嵌入文體,樣式沒有color, font-size等等必須嵌入文本得使用內嵌入text組件方式
1三、native ios 環境下<list>組件沒有auto 高度,默認高度爲0px,致使顯示不了<cell>組件內容。
1四、native 不支持一下css選擇器,好比::last-child、:nth-child(n)等等
1五、text 組件的父父級設置了display: flex; text 組件的父級必須得設置flex,否則text 組件換行無效。less

clipboard.png

1六、設置display: flex,height。致使padding計算到height上。好比:flex

display: flex; height: 200px; padding-top: 20px;
展現的結果是 整個元素高度仍是200px ,內部內容向下移動20px

1七、native <text> 不支持oblique傾斜, 支持italic斜體。font-style: italic;
1八、使用<scroller>組件時,其組件內元素默認背景白色,若是須要在<scroller>內部設置新顏色,得在<scroller>組件內嵌入div組件
20、焦點圖組件兼容問題:若是設置style 的scoped屬性,會致使H5設置indicator組件樣式不生效。解決方案:在焦點圖的組件上去掉scoped屬性,設置indicator
2一、使用<scroller>組件設置水平方向滑動時,在ios native <scroller>組件的高度不支持auto,必須得統一給<scroller>組件設置固定高度。
2二、android native不支持負值margin-top: -50px;而且H5跟ios native解析margin-top: -50px; 結果不一致, 使用position, top 解決
2三、若是定位元素超過容器邊界,在 Android native下,超出部分將不可見,緣由在於 Android 端元素 overflow 默認值爲 hidden,但目前 Android 暫不支持設置 overflow: visible。
2四、列表: 在 Android native下設置border-top 1px被下個節點覆蓋,解決方式 margin-top: 1px;spa

相關文章
相關標籤/搜索