uni-app相关
uni-app 中以下組件的高度是固定的,不可修改:
導(dǎo)航欄高度固定為 44px
tabBar 高度固定為 56px
狀態(tài)欄比較特殊,是一個(gè)變量
.status_bar{height: var(--status-bar-height);width: 100%; }?
?
uni-app 使用 vue/cli 創(chuàng)建項(xiàng)目的時(shí)候,如果使用 scss 語(yǔ)法,在正常安裝 node-sass 和 sass-loader 之后編譯依然出錯(cuò)
解決辦法
npm i sass-loader@7.3降低 sass-loader 的版本即可
也可以選擇另外一種解決方案,使用 stylus ,和 uni-app 無沖突。
?
?
自定義導(dǎo)航條——解決內(nèi)容展示在狀態(tài)欄的問題
下面是 CSS,背景色請(qǐng)根據(jù)自己的需求設(shè)置,我這邊是需要展示全頁(yè)面的背景圖。
.bararea {position: relative;.barfixed {position: fixed;width: 100%;left: 0;top: 0;z-index: 998;} }.status_bar {height: var(--status-bar-height);width: 100%; }.nav_bar {position: relative;z-index: 999;background: transparent; }下面是 HTML
<!-- #ifdef APP-PLUS --> <view class="bararea"><view class="barfixed"><view class="status_bar"><!-- 這里是狀態(tài)欄 --></view><view class="nav_bar"><!-- 這里是導(dǎo)航欄 --></view></view><view class="barplaceholder"><view class="status_bar"><!-- 這里是狀態(tài)欄 --></view><view class="nav_bar"><!-- 這里是導(dǎo)航欄 --></view></view> </view> <!-- #endif -->?
在 uni-app 中,Vuex 里面的數(shù)據(jù)在 h5 可以正常訪問,但是在真機(jī)上訪問失敗。
打印值看到 $store 為 unidentified ,看文章后發(fā)現(xiàn)需要把 store 掛載在 Vue 的?prototype 上面,在 main.js 中引入
import store from './store/index.js' Vue.prototype.$store=store const app = new Vue({store,...App }) app.$mount()?
?
uni-app 真機(jī)不支持 v-show 。
?
uni-app 真機(jī)不支持 :style 動(dòng)態(tài)改變?cè)貙捀叩膯栴}
<view :class="['jindu',item.GenStatus===2?'done':'']" :style="forMatWidth(item)"></view> forMatWidth(data) {return "width:"+(data.GenUsed / data.GenTotal) * 100 + "%;"; },使用上面這種方式,在 h5 平臺(tái)生效, app 不生效。
修復(fù)版本
<view :class="['jindu',item.GenStatus===2?'done':'']" :style="{width:forMatWidth(item)}"></view> forMatWidth(data) {return (data.GenUsed / data.GenTotal) * 100 + "%;"; },?
轉(zhuǎn)載于:https://www.cnblogs.com/gitByLegend/p/11447155.html
總結(jié)
- 上一篇: vue定义global.js,挂载在vu
- 下一篇: springboot打war包汇总