123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- <template>
- <view class="u-navbar-mini" :class="[customClass]">
- <view class="u-navbar-mini__inner" :class="[fixed && 'u-navbar-mini--fixed']">
- <u-status-bar
- v-if="safeAreaInsetTop"
- ></u-status-bar>
- <view
- class="u-navbar-mini__content"
- :class="[border && 'u-border-bottom']"
- :style="{
- height: addUnit(height),
- backgroundColor: bgColor,
- }"
- >
- <view
- class="u-navbar-mini__content__left"
- hover-class="u-navbar-mini__content__left--hover"
- hover-start-time="150"
- @tap="leftClick"
- >
- <slot name="left">
- <up-icon
- :name="leftIcon"
- :size="iconSize"
- :color="iconColor"
- ></up-icon>
- </slot>
- </view>
- <view style="padding: 10px 10px;">
- <up-line direction="col" color="#fff" length="16px"></up-line>
- </view>
- <view
- class="u-navbar-mini__content__center" @tap="homeClick">
- <slot name="center">
- <up-icon name="home" :size="iconSize" :color="iconColor"></up-icon>
- </slot>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import { props } from './props';
- import { mpMixin } from '../../libs/mixin/mpMixin';
- import { mixin } from '../../libs/mixin/mixin';
- import { addUnit, addStyle, getPx, sys } from '../../libs/function/index';
-
- export default {
- name: 'u-navbar-mini',
- mixins: [mpMixin, mixin, props],
- data() {
- return {
- }
- },
- emits: ["leftClick", "homeClick"],
- created() {
- },
- methods: {
- addStyle,
- addUnit,
- sys,
- getPx,
- // 点击左侧区域
- leftClick() {
- // 如果配置了autoBack,自动返回上一页
- this.$emit('leftClick')
- if(this.autoBack) {
- uni.navigateBack()
- }
- },
- homeClick() {
- if (this.homeUrl) {
- uni.reLaunch({ url: this.homeUrl })
- }
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- @import "../../libs/css/components.scss";
- .u-navbar-mini {
- &__inner {
- width: 180rpx;
- overflow: hidden;
- }
- &
- position: fixed;
- left: 20px;
- right: 0;
- top: 10px;
- z-index: 11;
- }
- &__content {
- @include flex(row);
- padding: 0 15px;
- border-radius: 20px;
- align-items: center;
- height: 36px;
- background-color: #9acafc;
- position: relative;
- justify-content: space-between;
- &__left {
- @include flex(row);
- align-items: center;
- }
- &__left {
- &
- opacity: 0.7;
- }
- }
- }
- }
- </style>
|