Dining_Hall/pages/components/Navbar.vue

87 lines
1.4 KiB
Vue
Raw Normal View History

2024-12-17 09:13:52 +08:00
<template>
2024-12-19 13:40:10 +08:00
<view>
<u-navbar
:title="title"
@leftClick="goBack"
@rightClick="chickIcon"
:autoBack="true"
placeholder
2025-01-02 19:39:21 +08:00
titleStyle="font-size: 16px;font-weight: 700;"
>
<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>
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: ''
2024-12-19 13:40:10 +08:00
}
2024-12-17 09:13:52 +08:00
},
data() {
return {}
},
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'
})
}
}
},
chickIcon() {
this.$emit('chickIcon')
}
}
}
</script>
2025-01-02 19:39:21 +08:00
<style lang="scss" scoped>
.right-text {
font-weight: 400;
font-size: 12px;
color: #0f274b;
}
</style>