添加全局提示

This commit is contained in:
kron
2025-07-02 17:21:44 +08:00
parent 5c5b72d556
commit 7fb72c9b1e
6 changed files with 261 additions and 228 deletions

View File

@@ -61,11 +61,12 @@ function handleTabClick(index) {
<style scoped>
.footer {
height: 90px;
width: 100%;
width: 100vw;
position: relative;
display: flex;
justify-content: space-around;
align-items: center;
overflow-x: hidden;
}
.footer-bg {

View File

@@ -2,6 +2,7 @@
import { ref, onMounted } from "vue";
import AppBackground from "@/components/AppBackground.vue";
import Header from "@/components/Header.vue";
import ScreenHint from "@/components/ScreenHint.vue";
defineProps({
title: {
type: String,
@@ -19,30 +20,45 @@ defineProps({
type: String,
default: "auto",
},
isHome: {
type: Boolean,
default: false,
},
});
const isIos = ref(true);
const showHint = ref(false);
const hintMessage = ref("");
onMounted(() => {
const deviceInfo = uni.getDeviceInfo();
isIos.value = deviceInfo.osName === "ios";
});
const showGlobalHint = (message) => {
hintMessage.value = message;
showHint.value = true;
};
uni.$showHint = showGlobalHint;
</script>
<template>
<view>
<AppBackground :type="bgType" />
<Header :title="title" :onBack="onBack" />
<Header v-if="!isHome" :title="title" :onBack="onBack" />
<view
class="content"
:style="{ height: `calc(100vh - ${isIos ? 98 : 95}px)`, overflow }"
:style="{ height: isHome ? '100vh' : `calc(100vh - ${isIos ? 98 : 95}px)`, overflow }"
>
<slot></slot>
</view>
<ScreenHint :show="showHint" :onClose="() => (showHint = false)">
{{ hintMessage }}
</ScreenHint>
</view>
</template>
<style scoped>
.content {
width: 100vw;
height: 100vh;
overflow-x: hidden;
display: flex;
flex-direction: column;