Files
frontend-app/components/header.vue
T
2025-08-05 15:25:23 +08:00

85 lines
1.6 KiB
Vue

<template>
<!-- 导航栏 -->
<view class="header_" >
<view style="margin-top: 20rpx;" @click="leftJump">
<up-image src="/static/common/left.png" width="18" height="20" bgColor="#f1f6ff00"/>
</view>
<view class="title_">{{leftTitle}}</view>
<view @click="rightJump">{{rightTitle}}</view>
</view>
</template>
<script>
export default {
name:"header",
props: {
leftTitle:{
type: String,
default: null
},
leftPath:{
type: String,
default: null
},
leftPathType:{
type: String,
default: "navigateTo"
},
rightTitle:{
type: String,
default: null
},
rightPath:{
type: String,
default: null
},
rightPathType:{
type: String,
default: "navigateTo"
},
},
data() {
return {
};
},
methods: {
leftJump() {
const leftPath = this.leftPath;
if(!leftPath){
return;
}
const leftPathType = this.leftPathType;
if(leftPathType === "navigateTo"){
uni.navigateTo({
url:leftPath,
})
}else if(leftPathType === "switchTab"){
uni.switchTab({
url: leftPath,
});
}
},
rightJump() {
const rightPath = this.rightPath;
if(!rightPath){
return;
}
const rightPathType = this.rightPathType;
if(rightPathType === "navigateTo"){
uni.navigateTo({
url:rightPath,
})
}else if(rightPathType === "switchTab"){
uni.switchTab({
url: rightPath,
});
}
},
}
}
</script>
<style lang="scss" scoped>
</style>