update: 修复android pina引用问题 h5 app-plus 不支持getMenuButtonBoundingClientRect方法

This commit is contained in:
admin 2024-05-09 10:45:07 +08:00
parent f87e508efd
commit ce8cb31b5b
10 changed files with 22 additions and 12 deletions

View File

@ -56,8 +56,9 @@ import Title from "@/components/Title/index.vue";
import TabBar from "@/components/TabBar/index.vue"; import TabBar from "@/components/TabBar/index.vue";
import { useMemberStore } from "@/store/index"; import { useMemberStore } from "@/store/index";
import { ProfileApi } from "@/services"; import { ProfileApi } from "@/services";
import pinia from '@/store'
const store = useMemberStore(); const store = useMemberStore(pinia);
const list = reactive([ const list = reactive([
{ {
title: "收货", title: "收货",

View File

@ -39,7 +39,7 @@ const getSafeHeight = () => {
// #endif // #endif
}; };
onMounted(() => { onMounted(() => {
// #ifdef APP-PLUS || MP-WEIXIN // #ifdef MP-WEIXIN
let menuButtonInfo = uni.getMenuButtonBoundingClientRect(); let menuButtonInfo = uni.getMenuButtonBoundingClientRect();
navbarRect.height = menuButtonInfo.height; navbarRect.height = menuButtonInfo.height;
navbarRect.top = menuButtonInfo.top; navbarRect.top = menuButtonInfo.top;

View File

@ -44,7 +44,7 @@ const navbarRect = reactive({
msgCount: 10, msgCount: 10,
}); });
onMounted(() => { onMounted(() => {
// #ifdef APP-PLUS || MP-WEIXIN // #ifdef MP-WEIXIN
let menuButtonInfo = uni.getMenuButtonBoundingClientRect(); let menuButtonInfo = uni.getMenuButtonBoundingClientRect();
navbarRect.height = menuButtonInfo.height; navbarRect.height = menuButtonInfo.height;
navbarRect.top = menuButtonInfo.top; navbarRect.top = menuButtonInfo.top;

View File

@ -21,7 +21,7 @@ const navbarRect = reactive({
}); });
onMounted(() => { onMounted(() => {
// #ifdef APP-PLUS || MP-WEIXIN // #ifdef MP-WEIXIN
let menuButtonInfo = uni.getMenuButtonBoundingClientRect(); let menuButtonInfo = uni.getMenuButtonBoundingClientRect();
navbarRect.height = menuButtonInfo.height; navbarRect.height = menuButtonInfo.height;
navbarRect.top = menuButtonInfo.top; navbarRect.top = menuButtonInfo.top;

View File

@ -86,7 +86,7 @@ watch(
// ,{ deep: true, immediate:true} // ,{ deep: true, immediate:true}
onLoad(() => { onLoad(() => {
// #ifdef APP-PLUS || MP-WEIXIN // #ifdef APP-PLUS || MP-WEIXIN || H5
getClineHeight(); getClineHeight();
// #endif // #endif
}); });

View File

@ -165,7 +165,9 @@ import {
import TabBar from "@/components/TabBar/index.vue"; import TabBar from "@/components/TabBar/index.vue";
import { formatMoney } from "@/utils"; import { formatMoney } from "@/utils";
import { onBackPress, onShow } from "@dcloudio/uni-app"; import { onBackPress, onShow } from "@dcloudio/uni-app";
const store = useMemberStore(); import pinia from '@/store'
const store = useMemberStore(pinia);
const navbarRect = reactive({ const navbarRect = reactive({
height: 32, height: 32,
top: 28, top: 28,
@ -550,7 +552,7 @@ const init = () => {
}); });
}; };
onMounted(() => { onMounted(() => {
// #ifdef APP-PLUS || MP-WEIXIN // #ifdef MP-WEIXIN
let menuButtonInfo = uni.getMenuButtonBoundingClientRect(); let menuButtonInfo = uni.getMenuButtonBoundingClientRect();
navbarRect.height = menuButtonInfo.height; navbarRect.height = menuButtonInfo.height;
navbarRect.top = menuButtonInfo.top; navbarRect.top = menuButtonInfo.top;

View File

@ -116,13 +116,15 @@ import { ProfileApi } from "@/services/index";
import LoginLayout from "./components/loginLayout.vue"; import LoginLayout from "./components/loginLayout.vue";
import { useMemberStore } from "@/store/index"; import { useMemberStore } from "@/store/index";
import valid from "@/utils/validate"; import valid from "@/utils/validate";
import pinia from '@/store'
const handleClear = (item: any) => { const handleClear = (item: any) => {
setTimeout(() => { setTimeout(() => {
(model1.userInfo as any)[item.key] = ""; (model1.userInfo as any)[item.key] = "";
}, 100); }, 100);
}; };
const store = useMemberStore(); const store = useMemberStore(pinia);
const loginForm = ref(null); const loginForm = ref(null);
const model1 = reactive({ const model1 = reactive({
userInfo: { userInfo: {

View File

@ -8,7 +8,9 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { useMemberStore } from '@/store/index' import { useMemberStore } from '@/store/index'
const store = useMemberStore() import pinia from '@/store'
const store = useMemberStore(pinia)
const profile = store.profile.userInfo const profile = store.profile.userInfo
</script> </script>
<style lang="scss"> <style lang="scss">

View File

@ -67,6 +67,8 @@ import { useMemberStore } from "@/store/index";
import TabBar from "@/components/TabBar/index.vue"; import TabBar from "@/components/TabBar/index.vue";
import SmallModal from "@/components/Modal/smallModal.vue"; import SmallModal from "@/components/Modal/smallModal.vue";
import Box from "@/components/Box/index.vue"; import Box from "@/components/Box/index.vue";
import pinia from '@/store'
const isShowCancelModal = ref(false); const isShowCancelModal = ref(false);
@ -82,7 +84,7 @@ const handleOk = () => {
} }
}); });
}; };
const store = useMemberStore(); const store = useMemberStore(pinia);
const profile = store.profile.userInfo; const profile = store.profile.userInfo;
const list = reactive([ const list = reactive([
{ {
@ -113,7 +115,7 @@ const hanldeClick = (item: any) => {
.bg { .bg {
width: 100%; width: 100%;
position: absolute; position: absolute;
top: -60rpx; top: 0rpx;
z-index: -1; z-index: -1;
} }
.baseinfo { .baseinfo {

View File

@ -1,5 +1,6 @@
import { useMemberStore } from "@/store/modules/member"; import { useMemberStore } from "@/store/modules/member";
import ENV_CONFIG from "../config/env"; import ENV_CONFIG from "../config/env";
import pinia from '@/store'
// 基础地址 // 基础地址
let baseUrl = ""; let baseUrl = "";
@ -10,7 +11,7 @@ let baseUrl = "";
baseUrl = (process.env as any).config[(process.env as any).NODE_ENV] baseUrl = (process.env as any).config[(process.env as any).NODE_ENV]
.VITE_APP_BASE_URL; .VITE_APP_BASE_URL;
const store = useMemberStore(); const store = useMemberStore(pinia);
const obj = { const obj = {
// 拦截前触发 // 拦截前触发