feat: 引入uView Plus组件库,新增部分静态页面

This commit is contained in:
admin
2026-01-17 16:55:19 +08:00
parent 34c63780a8
commit 849647d3c9
562 changed files with 73370 additions and 121 deletions

View File

@@ -0,0 +1,15 @@
import { defineMixin } from '../../libs/vue'
import defProps from '../../libs/config/props.js'
export const props = defineMixin({
props: {
bgColor: {
type: String,
default: () => defProps.statusBar.bgColor
},
// 状态栏获取得高度
height: {
type: Number,
default: () => defProps.statusBar.height
}
}
})

View File

@@ -0,0 +1,16 @@
/*
* @Author : LQ
* @Description :
* @version : 3.0
* @Date : 2021-08-20 16:44:21
* @LastAuthor : jry
* @lastTime : 2025-12-19 08:55:21
* @FilePath : /uview-plus/libs/config/props/statusBar.js
*/
export default {
// statusBar
statusBar: {
bgColor: 'transparent',
height: 0
}
}

View File

@@ -0,0 +1,63 @@
<template>
<view
:style="[style]"
class="u-status-bar"
:class="[isH5 && 'u-safe-area-inset-top']"
>
<slot />
</view>
</template>
<script>
import { props } from './props';
import { mpMixin } from '../../libs/mixin/mpMixin';
import { mixin } from '../../libs/mixin/mixin';
import { addUnit, addStyle, deepMerge, getWindowInfo } from '../../libs/function/index';
/**
* StatbusBar 状态栏占位
* @description 本组件主要用于状态填充,比如在自定导航栏的时候,它会自动适配一个恰当的状态栏高度。
* @tutorial https://uview-plus.jiangruyi.com/components/statusBar.html
* @property {String} bgColor 背景色 (默认 'transparent' )
* @property {String | Object} customStyle 自定义样式
* @example <u-status-bar></u-status-bar>
*/
export default {
name: 'u-status-bar',
mixins: [mpMixin, mixin, props],
data() {
return {
isH5: false
}
},
created() {
// #ifdef H5
this.isH5 = true
// #endif
},
emits: ['update:height'],
computed: {
style() {
const style = {}
// 状态栏高度由于某些安卓和微信开发工具无法识别css的顶部状态栏变量所以使用js获取的方式
let sheight = getWindowInfo().statusBarHeight
this.$emit('update:height', sheight)
if (sheight == 0) {
this.isH5 = true
} else {
style.height = addUnit(sheight, 'px')
}
style.backgroundColor = this.bgColor
return deepMerge(style, addStyle(this.customStyle))
}
},
}
</script>
<style lang="scss" scoped>
.u-status-bar {
// nvue会默认100%如果nvue下显式写100%的话会导致宽度不为100%而异常
/* #ifndef APP-NVUE */
width: 100%;
/* #endif */
}
</style>