Dining_Hall/pages/components/Navbar.vue

77 lines
1.2 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"
:rightText="text"
placeholder
></u-navbar>
</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>
2024-12-19 13:40:10 +08:00
<style lang="scss"></style>