feat: webview 的导航栏样式处理
This commit is contained in:
@@ -23,6 +23,15 @@
|
|||||||
"style": {
|
"style": {
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/webview/index",
|
||||||
|
"style": {
|
||||||
|
"navigationStyle": "custom",
|
||||||
|
"backgroundColor": "#FFFFFF",
|
||||||
|
"navigationBarBackgroundColor": "#FFFFFF",
|
||||||
|
"navigationBarTextStyle": "black"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"subPackages": [
|
"subPackages": [
|
||||||
|
|||||||
@@ -1,26 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="webview">
|
<view>
|
||||||
<!-- 使用 NavBar 组件 -->
|
|
||||||
<TopNavBar title="网页浏览" @back="goBack" />
|
|
||||||
|
|
||||||
<!-- WebView 内容区域 -->
|
|
||||||
<view class="webview-content">
|
|
||||||
<web-view :src="webviewUrl"></web-view>
|
<web-view :src="webviewUrl"></web-view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted } from "vue";
|
import { ref, onMounted } from "vue";
|
||||||
import TopNavBar from "@/components/TopNavBar/index.vue";
|
|
||||||
|
|
||||||
const webviewUrl = ref("");
|
const webviewUrl = ref("");
|
||||||
|
|
||||||
// 返回上一页
|
|
||||||
const goBack = () => {
|
|
||||||
uni.navigateBack();
|
|
||||||
};
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// 获取页面参数
|
// 获取页面参数
|
||||||
const pages = getCurrentPages();
|
const pages = getCurrentPages();
|
||||||
@@ -35,22 +23,4 @@ onMounted(() => {
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped></style>
|
||||||
.webview {
|
|
||||||
width: 100%;
|
|
||||||
height: 100vh;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
background-color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.webview-content {
|
|
||||||
flex: 1;
|
|
||||||
margin-top: calc(44px + var(--status-bar-height));
|
|
||||||
}
|
|
||||||
|
|
||||||
.webview-content {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|||||||
Reference in New Issue
Block a user