From d1448cb0ef10f358bb7bddb4e1ec268515e0b787 Mon Sep 17 00:00:00 2001 From: gaoluyang <2820782392@qq.com> Date: 星期二, 15 七月 2025 11:46:57 +0800 Subject: [PATCH] 项目初始化 --- components/navbar/Navbar.vue | 117 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 117 insertions(+), 0 deletions(-) diff --git a/components/navbar/Navbar.vue b/components/navbar/Navbar.vue new file mode 100644 index 0000000..53dc20c --- /dev/null +++ b/components/navbar/Navbar.vue @@ -0,0 +1,117 @@ +<template> + <block v-if="isShow()"> + <view v-if="hideBtn" class="u-navbar" :style="{ backgroundColor: bgColor, textAlign: 'center' }"> + <view + class="u-navbar__placeholder" + v-if="fixed" + :style="{ + height: $u.addUnit($u.getPx(height) + $u.sys().statusBarHeight,'px'), + }" + ></view> + <view :class="[fixed && 'u-navbar--fixed']"> + <u-status-bar v-if="safeAreaInsetTop" :bgColor="bgColor"></u-status-bar> + <view class="u-navbar__content" :class="[border && 'u-border-bottom']" :style="{ height: contentHeight, backgroundColor: bgColor }"> + <view class="u-navbar__content__left" hover-class="u-navbar__content__left--hover" hover-start-time="150" style="position: relative;"> + <text class="u-line-1 u-navbar__content__title" :style="[{ height: contentHeight, lineHeight: contentHeight, margin: '0 auto' }, $u.addStyle(titleStyle)]"> + {{ title }} + </text> + </view> + </view> + </view> + </view> + <u-navbar v-else :title="title" :autoBack="true" :placeholder="true" :bgColor="bgColor"></u-navbar> + </block> +</template> + +<script> +import props from './props.js'; +/** + * Navbar 鑷畾涔夊鑸爮 + * @property {Boolean} h5Show 鏄惁鍦╤5妯″紡涓嬫樉绀� 锛堥粯璁� false 锛� + * @property {Boolean} hideBtn 鏄惁闅愯棌杩斿洖鎸夐挳 锛堥粯璁� false 锛� + */ +export default { + mixins: [props], + props: { + h5Show: Boolean, + hideBtn: Boolean, + back: Boolean, + home: Boolean + }, + data () { + return { + systemInfo : this.$store.getters.getSystemInfo, + statusBarHeight: uni.$u.addUnit(uni.$u.getPx(this.height) + uni.$u.sys().statusBarHeight, 'px'), + contentHeight: uni.$u.addUnit(this.height) + } + }, + methods: { + isShow () { + if (this.systemInfo.uniPlatform == 'web') { + return this.h5Show + } + return true; + } + } +} +</script> + +<style lang="scss" scoped> + .u-navbar { + + &--fixed { + position: fixed; + left: 0; + right: 0; + top: 0; + z-index: 11; + } + + &__content { + @include flex(row); + align-items: center; + height: 44px; + background-color: #9acafc; + position: relative; + justify-content: center; + + &__left, + &__right { + padding: 0 13px; + position: absolute; + top: 0; + bottom: 0; + @include flex(row); + align-items: center; + } + + &__left { + left: 0; + + &--hover { + opacity: 0.7; + } + + &__text { + font-size: 15px; + margin-left: 3px; + } + } + + &__title { + text-align: center; + font-size: 16px; + color: $u-main-color; + } + + &__right { + right: 0; + + &__text { + font-size: 15px; + margin-left: 3px; + } + } + } + } +</style> \ No newline at end of file -- Gitblit v1.9.3