feat: 添加navbar导航栏

修复屏幕宽度过宽导致的苹果手机无法返回的问题
This commit is contained in:
2025-08-25 14:36:41 +08:00
parent 946f4a2e6b
commit 5adbe3f18d
2 changed files with 18 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
<template> <template>
<view class="top"> <view class="top" :class="[sticky ? 'sticky': '']">
<view v-show="showBack" class="top-back" @click="toBack()"> <view v-show="showBack" class="top-back" @click="toBack()">
<u-icon color="#333" size="20" name="arrow-left"></u-icon> <u-icon color="#333" size="20" name="arrow-left"></u-icon>
</view> </view>
@@ -24,11 +24,16 @@
goPgae:{ goPgae:{
type:String, type:String,
default:'' default:''
} },
// 启用粘性滚动
sticky: {
type: Boolean,
default: false
}
}, },
data() { data() {
return { return {
} }
}, },
methods: { methods: {
@@ -45,7 +50,7 @@
uni.switchTab({ uni.switchTab({
url:this.backUrl url:this.backUrl
}) })
}else{ }else{
uni.navigateTo({ uni.navigateTo({
url:this.backUrl url:this.backUrl
}); });
@@ -61,7 +66,7 @@
}else{ }else{
uni.navigateBack(); uni.navigateBack();
} }
} }
} }
} }
@@ -94,6 +99,13 @@
text-overflow: ellipsis; text-overflow: ellipsis;
line-height: 40px; line-height: 40px;
} }
&.sticky {
position: sticky;
top: 0;
//防止其他元素遮盖
z-index: 99;
}
} }
// .arrow:before { // .arrow:before {
// content: " "; // content: " ";

View File

@@ -1,6 +1,7 @@
<template> <template>
<!--新的课程学习页面没有中间的详细页面了课程点过来就是这个用户未报名就直接报名--> <!--新的课程学习页面没有中间的详细页面了课程点过来就是这个用户未报名就直接报名-->
<view> <view>
<page-title :showBack="true" :sticky="true">视频详情</page-title>
<watermark></watermark> <watermark></watermark>
<u-toast ref="messager"></u-toast> <u-toast ref="messager"></u-toast>
<!-- <page-title :showBack="true"></page-title> --> <!-- <page-title :showBack="true"></page-title> -->