Dining_Hall/pages/components/Navbar.vue

95 lines
1.6 KiB
Vue
Raw Normal View History

2024-12-17 09:13:52 +08:00
<template>
<page-meta :page-font-size="fontValue+'px'" :root-font-size="fontValue+'px'"></page-meta>
2024-12-19 13:40:10 +08:00
<view>
<u-navbar
:title="title"
@leftClick="goBack"
2025-01-03 12:15:58 +08:00
@rightClick="clickIcon"
2024-12-19 13:40:10 +08:00
:autoBack="true"
2025-06-17 16:19:23 +08:00
placeholder :leftIconSize="leftIconSize"
titleStyle="font-size: 32rpx;font-weight: 700;"
2025-01-02 19:39:21 +08:00
>
<view slot="right">
<span class="right-text">{{ text }}</span>
</view>
</u-navbar>
2024-12-19 13:40:10 +08:00
</view>
2024-12-17 09:13:52 +08:00
</template>
<script>
2025-04-27 15:58:51 +08:00
2024-12-17 09:13:52 +08:00
export default {
props: {
title: {
type: String,
default: ''
},
showBack: {
type: Boolean,
default: true
},
isBack: {
type: Boolean,
default: true
},
goTo: {
type: String,
default: ''
},
rightIcon: {
type: String,
default: 'plus'
},
showRightIcon: {
type: Boolean,
default: false
2024-12-17 09:25:52 +08:00
},
2024-12-18 08:56:39 +08:00
showRightText: {
type: Boolean,
default: false
},
2024-12-17 09:25:52 +08:00
text: {
type: String,
default: ''
2025-06-17 16:19:23 +08:00
},
leftIconSize:{
type: Number,
default: 20
}
2024-12-17 09:13:52 +08:00
},
data() {
return {
2025-04-27 15:58:51 +08:00
fontValue:uni.getStorageSync('fontSize') || 8,
}
2024-12-17 09:13:52 +08:00
},
methods: {
goBack() {
if (this.isBack) {
uni.navigateBack()
} else {
if (this.goTo) {
uni.redirectTo({
url: this.goTo
})
} else {
2024-12-24 13:02:43 +08:00
uni.switchTab({
2024-12-17 09:13:52 +08:00
url: '/pages/index'
})
}
}
},
2025-01-03 12:15:58 +08:00
clickIcon() {
2025-01-03 12:19:09 +08:00
this.$emit('clickIcon')
2024-12-17 09:13:52 +08:00
}
}
}
</script>
2025-01-02 19:39:21 +08:00
<style lang="scss" scoped>
.right-text {
font-weight: 400;
font-size: 24rpx;
2025-01-02 19:39:21 +08:00
color: #0f274b;
}
</style>