1.nvue 頁面只能使用 flex 布局
2.布局不能使用百分比、沒有媒體查詢。
3.選擇器僅支持class 選擇器
/* 錯誤 */ #id {} .a .b .c {} .a > .b {} /* 正確 */ .class {}
border 不支持簡寫
/* 錯誤 */ .class { border: 1px red solid; } /* 正確 */ .class { border-width: 1px; border-style: solid; border-color: red; }
background 不支持簡寫
/* 錯誤 */ .class { background: red; } /* 正確 */ .class { background-color: red; }
/* 錯誤 */ /* 控制台警告: WARNING: `border` is not a standard property name (may not be supported) WARNING: `-webkit-transform` is not a standard property name (may not be supported) */ .class { border: 1px red solid; -webkit-transform: scaleY(.5); } /* 正確 */ .class { border-width: 1px; border-style: solid; border-color: red; /* #ifndef APP-PLUS-NVUE */ -webkit-transform: scaleY(.5); /* #endif*/ }
4.nvue 頁面控制顯隱只可以使用v-if
不可以使用v-show (控制元素顯示隱藏,v-if和v-else結合使用,寫兩個v-if會造成樣式錯亂等)
5.h5正常app異常body的元素選擇器請改為page,同樣,div和ul和li等改為view、span和font改為text、a改為navigator、img改為image...
6.uni-app開發中遇到的問題 https://www.cnblogs.com/nanyang520/p/11758187.html
7.uniapp報錯 uniapp reportJSException >>>> exception function:GraphicActionAddElement, exception....
可能的問題:text標簽中加了其他的標簽
<text class="recommend-info"> <text class="media-author">{{item.username}}</text> <text class="media-author recommend-date"> {{time()}}</text> </text>
我這寫的就報錯uniapp reportJSException >>>> exception function:GraphicActionAddElement, exception.... 然后改了
<view class="recommend-info"> <text class="media-author">{{item.username}}</text> <text class="media-author recommend-date"> {{time()}}</text> </view>
這樣就可以了。
提示:在寫nvue頁面要非常注重規范呢
8.nvue中內容超過用省略號( 前提要設置text的寬度)
.info-text-first{ lines: 1; width:362upx; text-overflow:ellipsis; margin-left: 20upx; }