Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
monorepo
/
venus
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
1
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 058eb04b
authored
Apr 13, 2026
by
岑成威
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat: tabbar调整
1 parent
862b896a
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
97 additions
and
148 deletions
apps/uniappX/uniapp-x-tape/.hbuilderx/launch.json
apps/uniappX/uniapp-x-tape/components/HomeFrame/MainTabShellLandscape.uvue
apps/uniappX/uniapp-x-tape/components/HomeFrame/MainTabShellPortrait.uvue
apps/uniappX/uniapp-x-tape/components/HomeFrame/SceneShell.uvue
apps/uniappX/uniapp-x-tape/components/HomeFrame/Tabbar.uvue
apps/uniappX/uniapp-x-tape/components/HomeFrame/TabbarLandscape.uvue
apps/uniappX/uniapp-x-tape/components/HomeFrame/TabbarPortrait.uvue
apps/uniappX/uniapp-x-tape/components/HomeFrame/index.uvue
apps/uniappX/uniapp-x-tape/components/HomeFrame/styles/common.scss
apps/uniappX/uniapp-x-tape/components/HomeFrame/styles/index.vars.uts
apps/uniappX/uniapp-x-tape/components/HomeFrame/tabbarShared.uts
apps/uniappX/uniapp-x-tape/pages.json
apps/uniappX/uniapp-x-tape/.hbuilderx/launch.json
View file @
058eb04
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
"configurations"
:
[
"configurations"
:
[
{
{
"customPlaygroundType"
:
"local"
,
"customPlaygroundType"
:
"local"
,
"playground"
:
"
custom
"
,
"playground"
:
"
standard
"
,
"type"
:
"uni-app:app-android"
"type"
:
"uni-app:app-android"
}
}
]
]
...
...
apps/uniappX/uniapp-x-tape/components/HomeFrame/MainTabShellLandscape.uvue
View file @
058eb04
<template>
<template>
<view class="main-tab-shell-root">
<view class="main-tab-shell-root">
<view class="main-tab-shell-body main-tab-shell-body-landscape">
<view class="main-tab-shell-body main-tab-shell-body-landscape">
<HomeFrameTabbarLandscape :adapter-class-name="adapterClassName"
<HomeFrameTabbarLandscape :user-name="userName"
:user-name="userName"
:current-tab-index="currentTabIndex"
:current-tab-index="currentTabIndex"
:scene-type-list="sceneTypeList"
:scene-type-list="sceneTypeList"
:show-scene-popup="showScenePopup"
:show-scene-popup="showScenePopup"
...
@@ -22,11 +21,12 @@
...
@@ -22,11 +21,12 @@
</template>
</template>
<script setup lang="uts">
<script setup lang="uts">
import { computed } from "vue";
import { computed
, inject, type Ref
} from "vue";
import HomeFrameTabbarLandscape from "./TabbarLandscape.uvue";
import HomeFrameTabbarLandscape from "./TabbarLandscape.uvue";
import type { HomeFrameTabbarSource } from "./tabbarShared.uts";
import type { HomeFrameTabbarSource } from "./tabbarShared.uts";
import { useHomeFrameTabbar } from "./tabbarShared.uts";
import { SCENE_SHELL_USER_INFO_INJECT_KEY, useHomeFrameTabbar } from "./tabbarShared.uts";
import { storage } from "@/utils/storage.uts";
type MainTabShellSlotProps = {
type MainTabShellSlotProps = {
userInfo: UTSJSONObject
userInfo: UTSJSONObject
...
@@ -40,17 +40,22 @@ defineSlots<MainTabShellSlots>();
...
@@ -40,17 +40,22 @@ defineSlots<MainTabShellSlots>();
const props = defineProps<{
const props = defineProps<{
activeTabIndex: number
activeTabIndex: number
userInfo?: null | UTSJSONObject
}>();
}>();
const shellUserInfoRef = inject(SCENE_SHELL_USER_INFO_INJECT_KEY, null) as Ref<UTSJSONObject> | null;
const tabbarSource: HomeFrameTabbarSource = {
const tabbarSource: HomeFrameTabbarSource = {
getAdapterClass: (): null | string => null,
getTabIndex: (): number => props.activeTabIndex,
getTabIndex: (): number => props.activeTabIndex,
getUserInfo: (): null | UTSJSONObject => props.userInfo as null | UTSJSONObject
getUserInfo: (): null | UTSJSONObject => {
const r = shellUserInfoRef;
if (r != null) {
return r.value as UTSJSONObject;
}
return storage.get("userInfo") as null | UTSJSONObject;
}
};
};
const _tabbar = useHomeFrameTabbar(tabbarSource);
const _tabbar = useHomeFrameTabbar(tabbarSource);
const adapterClassName = _tabbar.adapterClassName;
const userName = _tabbar.userName;
const userName = _tabbar.userName;
const currentTabIndex = _tabbar.currentTabIndex;
const currentTabIndex = _tabbar.currentTabIndex;
const sceneTypeList = _tabbar.sceneTypeList;
const sceneTypeList = _tabbar.sceneTypeList;
...
@@ -65,8 +70,12 @@ const onChooseScene = _tabbar.onChooseScene;
...
@@ -65,8 +70,12 @@ const onChooseScene = _tabbar.onChooseScene;
const jumpPersonCenter = _tabbar.jumpPersonCenter;
const jumpPersonCenter = _tabbar.jumpPersonCenter;
const slotUserInfo = computed((): UTSJSONObject => {
const slotUserInfo = computed((): UTSJSONObject => {
const u = props.userInfo;
const r = shellUserInfoRef;
return u != null ? u : ({} as UTSJSONObject);
if (r != null) {
return r.value as UTSJSONObject;
}
const raw = storage.get("userInfo");
return raw != null ? raw as UTSJSONObject : ({} as UTSJSONObject);
});
});
</script>
</script>
...
...
apps/uniappX/uniapp-x-tape/components/HomeFrame/MainTabShellPortrait.uvue
View file @
058eb04
...
@@ -4,11 +4,7 @@
...
@@ -4,11 +4,7 @@
<view class="main-tab-shell-slot main-tab-shell-slot-portrait">
<view class="main-tab-shell-slot main-tab-shell-slot-portrait">
<slot :user-info="slotUserInfo"></slot>
<slot :user-info="slotUserInfo"></slot>
</view>
</view>
<HomeFrameTabbarPortrait :adapter-class-name="adapterClassName"
<HomeFrameTabbarPortrait :current-tab-index="currentTabIndex"
:is-pad-portrait-mode="isPadPortraitMode"
:tabbar-height="tabbarHeight"
:tabbar-icon-size="tabbarIconSize"
:current-tab-index="currentTabIndex"
:scene-type-list="sceneTypeList"
:scene-type-list="sceneTypeList"
:show-scene-popup="showScenePopup"
:show-scene-popup="showScenePopup"
:show-setting="showSetting"
:show-setting="showSetting"
...
@@ -21,11 +17,12 @@
...
@@ -21,11 +17,12 @@
</template>
</template>
<script setup lang="uts">
<script setup lang="uts">
import { computed } from "vue";
import { computed
, inject, type Ref
} from "vue";
import HomeFrameTabbarPortrait from "./TabbarPortrait.uvue";
import HomeFrameTabbarPortrait from "./TabbarPortrait.uvue";
import type { HomeFrameTabbarSource } from "./tabbarShared.uts";
import type { HomeFrameTabbarSource } from "./tabbarShared.uts";
import { useHomeFrameTabbar } from "./tabbarShared.uts";
import { SCENE_SHELL_USER_INFO_INJECT_KEY, useHomeFrameTabbar } from "./tabbarShared.uts";
import { storage } from "@/utils/storage.uts";
type MainTabShellSlotProps = {
type MainTabShellSlotProps = {
userInfo: UTSJSONObject
userInfo: UTSJSONObject
...
@@ -39,20 +36,22 @@ defineSlots<MainTabShellSlots>();
...
@@ -39,20 +36,22 @@ defineSlots<MainTabShellSlots>();
const props = defineProps<{
const props = defineProps<{
activeTabIndex: number
activeTabIndex: number
userInfo?: null | UTSJSONObject
}>();
}>();
const shellUserInfoRef = inject(SCENE_SHELL_USER_INFO_INJECT_KEY, null) as Ref<UTSJSONObject> | null;
const tabbarSource: HomeFrameTabbarSource = {
const tabbarSource: HomeFrameTabbarSource = {
getAdapterClass: (): null | string => null,
getTabIndex: (): number => props.activeTabIndex,
getTabIndex: (): number => props.activeTabIndex,
getUserInfo: (): null | UTSJSONObject => props.userInfo as null | UTSJSONObject
getUserInfo: (): null | UTSJSONObject => {
const r = shellUserInfoRef;
if (r != null) {
return r.value as UTSJSONObject;
}
return storage.get("userInfo") as null | UTSJSONObject;
}
};
};
const _tabbar = useHomeFrameTabbar(tabbarSource);
const _tabbar = useHomeFrameTabbar(tabbarSource);
const adapterClassName = _tabbar.adapterClassName;
const isPadPortraitMode = _tabbar.isPadPortraitMode;
const tabbarHeight = _tabbar.tabbarHeight;
const tabbarIconSize = _tabbar.tabbarIconSize;
const currentTabIndex = _tabbar.currentTabIndex;
const currentTabIndex = _tabbar.currentTabIndex;
const sceneTypeList = _tabbar.sceneTypeList;
const sceneTypeList = _tabbar.sceneTypeList;
const showScenePopup = _tabbar.showScenePopup;
const showScenePopup = _tabbar.showScenePopup;
...
@@ -63,8 +62,12 @@ const onSettingVisible = _tabbar.onSettingVisible;
...
@@ -63,8 +62,12 @@ const onSettingVisible = _tabbar.onSettingVisible;
const onChooseScene = _tabbar.onChooseScene;
const onChooseScene = _tabbar.onChooseScene;
const slotUserInfo = computed((): UTSJSONObject => {
const slotUserInfo = computed((): UTSJSONObject => {
const u = props.userInfo;
const r = shellUserInfoRef;
return u != null ? u : ({} as UTSJSONObject);
if (r != null) {
return r.value as UTSJSONObject;
}
const raw = storage.get("userInfo");
return raw != null ? raw as UTSJSONObject : ({} as UTSJSONObject);
});
});
</script>
</script>
...
...
apps/uniappX/uniapp-x-tape/components/HomeFrame/SceneShell.uvue
View file @
058eb04
<template>
<template>
<!-- 物理 tab 三页共用:横/竖两套壳 + 默认槽;方向由 updateOrientation + useOrientation 驱动 -->
<!-- 物理 tab 三页共用:横/竖两套壳 + 默认槽;方向由 updateOrientation + useOrientation 驱动 -->
<MainTabShellPortrait v-if="shellIsPortrait"
<MainTabShellPortrait v-if="shellIsPortrait"
:active-tab-index="props.activeTabIndex"
:active-tab-index="props.activeTabIndex">
:user-info="userInfo">
<template #default="{ userInfo: u }">
<template #default="{ userInfo: u }">
<slot :user-info="u"></slot>
<slot :user-info="u"></slot>
</template>
</template>
</MainTabShellPortrait>
</MainTabShellPortrait>
<MainTabShellLandscape v-else
<MainTabShellLandscape v-else
:active-tab-index="props.activeTabIndex"
:active-tab-index="props.activeTabIndex">
:user-info="userInfo">
<template #default="{ userInfo: u }">
<template #default="{ userInfo: u }">
<slot :user-info="u"></slot>
<slot :user-info="u"></slot>
</template>
</template>
...
@@ -17,7 +15,7 @@
...
@@ -17,7 +15,7 @@
</template>
</template>
<script setup lang="uts">
<script setup lang="uts">
import { computed, defineExpose, onMounted, onResize, ref, type Ref } from "vue";
import { computed, defineExpose, onMounted, onResize,
provide,
ref, type Ref } from "vue";
import { updateOrientation, useOrientation } from "@/services/adapter/hooks/index.uts";
import { updateOrientation, useOrientation } from "@/services/adapter/hooks/index.uts";
import { requestRecordPermission } from "@/utils/permission.uts";
import { requestRecordPermission } from "@/utils/permission.uts";
...
@@ -26,6 +24,7 @@ import { hideNativeTabBar } from "@/utils/tabBarShell.uts";
...
@@ -26,6 +24,7 @@ import { hideNativeTabBar } from "@/utils/tabBarShell.uts";
import MainTabShellLandscape from "./MainTabShellLandscape.uvue";
import MainTabShellLandscape from "./MainTabShellLandscape.uvue";
import MainTabShellPortrait from "./MainTabShellPortrait.uvue";
import MainTabShellPortrait from "./MainTabShellPortrait.uvue";
import { SCENE_SHELL_USER_INFO_INJECT_KEY } from "./tabbarShared.uts";
type SceneShellSlotProps = {
type SceneShellSlotProps = {
userInfo: UTSJSONObject
userInfo: UTSJSONObject
...
@@ -51,6 +50,8 @@ const shellIsPortrait = computed((): boolean => {
...
@@ -51,6 +50,8 @@ const shellIsPortrait = computed((): boolean => {
});
});
onMounted((): void => {
onMounted((): void => {
requestRecordPermission();
hideNativeTabBar();
updateOrientation();
updateOrientation();
});
});
...
@@ -59,6 +60,7 @@ onResize((_res: any): void => {
...
@@ -59,6 +60,7 @@ onResize((_res: any): void => {
});
});
const userInfo = ref<UTSJSONObject>({});
const userInfo = ref<UTSJSONObject>({});
provide(SCENE_SHELL_USER_INFO_INJECT_KEY, userInfo);
function updateApp(): void {
function updateApp(): void {
const info = storage.get("userInfo");
const info = storage.get("userInfo");
...
@@ -67,12 +69,6 @@ function updateApp(): void {
...
@@ -67,12 +69,6 @@ function updateApp(): void {
}
}
}
}
onLoad((_options) => {
requestRecordPermission();
hideNativeTabBar();
updateOrientation();
});
onShow(() => {
onShow(() => {
hideNativeTabBar();
hideNativeTabBar();
});
});
...
...
apps/uniappX/uniapp-x-tape/components/HomeFrame/Tabbar.uvue
View file @
058eb04
<template>
<template>
<HomeFrameTabbarLandscape v-if="!isPortraitMode"
<HomeFrameTabbarLandscape v-if="!isPortraitMode"
:adapter-class-name="adapterClassName"
:user-name="userName"
:user-name="userName"
:current-tab-index="currentTabIndex"
:current-tab-index="currentTabIndex"
:scene-type-list="sceneTypeList"
:scene-type-list="sceneTypeList"
...
@@ -14,10 +13,6 @@
...
@@ -14,10 +13,6 @@
@choose-scene="onChooseScene"
@choose-scene="onChooseScene"
@jump-person-center="jumpPersonCenter" />
@jump-person-center="jumpPersonCenter" />
<HomeFrameTabbarPortrait v-else
<HomeFrameTabbarPortrait v-else
:adapter-class-name="adapterClassName"
:is-pad-portrait-mode="isPadPortraitMode"
:tabbar-height="tabbarHeight"
:tabbar-icon-size="tabbarIconSize"
:current-tab-index="currentTabIndex"
:current-tab-index="currentTabIndex"
:scene-type-list="sceneTypeList"
:scene-type-list="sceneTypeList"
:show-scene-popup="showScenePopup"
:show-scene-popup="showScenePopup"
...
@@ -39,7 +34,6 @@ import type { HomeFrameTabbarSource } from "./tabbarShared.uts";
...
@@ -39,7 +34,6 @@ import type { HomeFrameTabbarSource } from "./tabbarShared.uts";
import { useHomeFrameTabbar } from "./tabbarShared.uts";
import { useHomeFrameTabbar } from "./tabbarShared.uts";
const props = defineProps<{
const props = defineProps<{
adapterClass?: string
tabIndex?: number
tabIndex?: number
userInfo?: null | UTSJSONObject
userInfo?: null | UTSJSONObject
}>();
}>();
...
@@ -51,19 +45,11 @@ const isPortraitMode = computed((): boolean => {
...
@@ -51,19 +45,11 @@ const isPortraitMode = computed((): boolean => {
});
});
const tabbarSource: HomeFrameTabbarSource = {
const tabbarSource: HomeFrameTabbarSource = {
getAdapterClass: (): null | string => props.adapterClass as null | string,
getTabIndex: (): number => props.tabIndex != null ? (props.tabIndex as number) : 0,
getTabIndex: (): number => props.tabIndex != null ? (props.tabIndex as number) : 0,
getUserInfo: (): null | UTSJSONObject => props.userInfo as null | UTSJSONObject
getUserInfo: (): null | UTSJSONObject => props.userInfo as null | UTSJSONObject
};
};
const _tabbar = useHomeFrameTabbar(tabbarSource);
const _tabbar = useHomeFrameTabbar(tabbarSource);
const adapterClassName = _tabbar.adapterClassName;
const isPadPortraitMode = _tabbar.isPadPortraitMode;
const tabbarHeight = _tabbar.tabbarHeight;
const tabbarIconSize = _tabbar.tabbarIconSize;
const landscapeTabbarRootStyle = _tabbar.landscapeTabbarRootStyle;
const landscapeTabbarInnerHeight = _tabbar.landscapeTabbarInnerHeight;
const landscapeTabbarIconSize = _tabbar.landscapeTabbarIconSize;
const currentTabIndex = _tabbar.currentTabIndex;
const currentTabIndex = _tabbar.currentTabIndex;
const sceneTypeList = _tabbar.sceneTypeList;
const sceneTypeList = _tabbar.sceneTypeList;
const userName = _tabbar.userName;
const userName = _tabbar.userName;
...
...
apps/uniappX/uniapp-x-tape/components/HomeFrame/TabbarLandscape.uvue
View file @
058eb04
<template>
<template>
<view class="home-tabbar home-tabbar-landscape"
<view class="home-tabbar home-tabbar-landscape">
:class="[adapterClassName]">
<!-- <image class="home-tabbar-bg-img"
<image class="home-tabbar-bg-img"
mode="aspectFill"
mode="aspectFill"
src="/static/images/home/left-bg.png" />
src="/static/images/home/left-bg.png" />
-->
<view class="hf-landscape-column">
<view class="hf-landscape-column">
<view class="user-box user-box-clickable hf-landscape-user"
<view class="user-box user-box-clickable hf-landscape-user"
@click="emit('jumpPersonCenter')">
@click="emit('jumpPersonCenter')">
<view class="hf-landscape-profile">
<view class="hf-landscape-profile">
<un-avatar :text="avatarText"
<un-avatar :text="avatarText"
shape="circle"
shape="circle"
size="
5
2"
size="
4
2"
bgColor="#2f6af7"
bgColor="#2f6af7"
color="#ffffff"
color="#ffffff"
fontSize="20" />
fontSize="20" />
...
@@ -33,19 +32,19 @@
...
@@ -33,19 +32,19 @@
</view>
</view>
</view>
</view>
</view>
</view>
<view class="home-tabbar-footer flex-col hf-landscape-footer"
>
</view
>
<view class="hf-landscape-footer-btn"
<view class="home-tabbar-footer flex-col hf-landscape-footer">
@tap="emit('sceneChange')">
<view class="hf-landscape-footer-btn"
<image class="hf-landscape-footer-icon"
@tap="emit('sceneChange')">
mode="aspectFit
"
<image class="hf-landscape-footer-icon
"
src="/static/images/home/scene-change.png" />
mode="aspectFit"
</view
>
src="/static/images/home/scene-change.png" /
>
<view class="hf-landscape-footer-btn hf-landscape-footer-btn--after"
</view>
@tap="emit('setting')">
<view class="hf-landscape-footer-btn hf-landscape-footer-btn--after"
<image class="hf-landscape-footer-icon"
@tap="emit('setting')">
mode="aspectFit
"
<image class="hf-landscape-footer-icon
"
src="/static/images/home/setting.png" />
mode="aspectFit"
</view
>
src="/static/images/home/setting.png" /
>
</view>
</view>
</view>
</view>
<CenterPopup :list="sceneTypeList"
<CenterPopup :list="sceneTypeList"
...
@@ -67,7 +66,6 @@ import SettingBox from "@/pages/person/SettingBox.uvue";
...
@@ -67,7 +66,6 @@ import SettingBox from "@/pages/person/SettingBox.uvue";
import { HOME_FRAME_TABS } from "./tabbarShared.uts";
import { HOME_FRAME_TABS } from "./tabbarShared.uts";
const props = defineProps<{
const props = defineProps<{
adapterClassName: string
userName: string
userName: string
currentTabIndex: number
currentTabIndex: number
sceneTypeList: UTSJSONObject[]
sceneTypeList: UTSJSONObject[]
...
@@ -108,16 +106,15 @@ function onTabItemClick(index: number): void {
...
@@ -108,16 +106,15 @@ function onTabItemClick(index: number): void {
<style scoped lang="scss">
<style scoped lang="scss">
@import "./styles/common.scss";
@import "./styles/common.scss";
/*
横屏侧栏主列:顶/左右/底对称留白,子块共一条竖直中轴
*/
/*
顶部用户区:仅内容高度,不把中间 Tab 区挤没
*/
.hf-landscape-column {
.hf-landscape-column {
flex: 1;
flex-shrink: 0;
min-height: 0;
width: 100%;
width: 100%;
display: flex;
display: flex;
flex-direction: column;
flex-direction: column;
align-items: center;
align-items: center;
box-sizing: border-box;
box-sizing: border-box;
padding: 14px 10px
20px
;
padding: 14px 10px
0
;
position: relative;
position: relative;
z-index: 1;
z-index: 1;
}
}
...
@@ -143,7 +140,7 @@ function onTabItemClick(index: number): void {
...
@@ -143,7 +140,7 @@ function onTabItemClick(index: number): void {
/* 与 MyCenterMain .name 一致;与 Tab 文案同宽便于视觉对齐 */
/* 与 MyCenterMain .name 一致;与 Tab 文案同宽便于视觉对齐 */
.hf-landscape-name {
.hf-landscape-name {
margin-top: 10px;
margin-top: 10px;
font-size: 1
9
px;
font-size: 1
4
px;
font-weight: 600;
font-weight: 600;
color: #1a2433;
color: #1a2433;
line-height: 24px;
line-height: 24px;
...
@@ -155,15 +152,6 @@ function onTabItemClick(index: number): void {
...
@@ -155,15 +152,6 @@ function onTabItemClick(index: number): void {
white-space: nowrap;
white-space: nowrap;
}
}
.hf-landscape-tab-wrap {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 0;
}
.hf-landscape-footer {
.hf-landscape-footer {
width: 100%;
width: 100%;
display: flex;
display: flex;
...
@@ -171,8 +159,8 @@ function onTabItemClick(index: number): void {
...
@@ -171,8 +159,8 @@ function onTabItemClick(index: number): void {
align-items: center;
align-items: center;
box-sizing: border-box;
box-sizing: border-box;
flex-shrink: 0;
flex-shrink: 0;
margin-top: auto
;
padding-left: 10px
;
padding-
bottom: 0
;
padding-
right: 10px
;
}
}
.hf-landscape-footer-btn {
.hf-landscape-footer-btn {
...
@@ -194,10 +182,11 @@ function onTabItemClick(index: number): void {
...
@@ -194,10 +182,11 @@ function onTabItemClick(index: number): void {
flex-shrink: 0;
flex-shrink: 0;
}
}
/* 横屏侧栏 Tab
区域
*/
/* 横屏侧栏 Tab
:占满中间 landscape-tabbar-wrap,条目在剩余高度内垂直居中
*/
.landscape-vertical-tabs {
.landscape-vertical-tabs {
flex: 1;
min-height: 0;
width: 100%;
width: 100%;
height: var(--tabbar-height, 540px);
padding-left: var(--tabbar-padding, 16px);
padding-left: var(--tabbar-padding, 16px);
padding-right: var(--tabbar-padding, 16px);
padding-right: var(--tabbar-padding, 16px);
padding-top: 8px;
padding-top: 8px;
...
@@ -231,8 +220,8 @@ function onTabItemClick(index: number): void {
...
@@ -231,8 +220,8 @@ function onTabItemClick(index: number): void {
}
}
.landscape-vertical-tabs__icon {
.landscape-vertical-tabs__icon {
width: var(--tabbar-icon-size
, 28px
);
width: var(--tabbar-icon-size);
height: var(--tabbar-icon-size
, 28px
);
height: var(--tabbar-icon-size);
flex-shrink: 0;
flex-shrink: 0;
}
}
...
...
apps/uniappX/uniapp-x-tape/components/HomeFrame/TabbarPortrait.uvue
View file @
058eb04
<template>
<template>
<view class="home-tabbar home-tabbar-portrait"
<view class="home-tabbar home-tabbar-portrait home-tabbar-portrait-pad">
:class="[adapterClassName, isPadPortraitMode ? 'home-tabbar-portrait-pad' : '']">
<un-tabbar :model-value="currentTabIndex"
<un-tabbar :model-value="currentTabIndex"
class="portrait-un-tabbar"
class="portrait-un-tabbar"
:fixed="true"
:fixed="true"
...
@@ -9,13 +8,12 @@
...
@@ -9,13 +8,12 @@
active-color="#3773f8"
active-color="#3773f8"
inactive-color="#8a98b5"
inactive-color="#8a98b5"
bg-color="#ffffff"
bg-color="#ffffff"
:height="tabbarHeight"
@change="emit('tabChange', ($event as string | number))">
@change="emit('tabChange', ($event as string | number))">
<un-tabbar-item v-for="(item, index) in tabs"
<un-tabbar-item v-for="(item, index) in tabs"
:key="index"
:key="index"
:name="index"
:name="index"
:text="item.label"
:text="item.label">
:icon-size="tabbarIconSize">
<template #icon="{ active }">
<template #icon="{ active }">
<image v-if="active === true"
<image v-if="active === true"
class="tabbar-icon-img"
class="tabbar-icon-img"
...
@@ -45,10 +43,6 @@ import SettingBox from "@/pages/person/SettingBox.uvue";
...
@@ -45,10 +43,6 @@ import SettingBox from "@/pages/person/SettingBox.uvue";
import { HOME_FRAME_TABS } from "./tabbarShared.uts";
import { HOME_FRAME_TABS } from "./tabbarShared.uts";
defineProps<{
defineProps<{
adapterClassName: string
isPadPortraitMode: boolean
tabbarHeight: number
tabbarIconSize: number
currentTabIndex: number
currentTabIndex: number
sceneTypeList: UTSJSONObject[]
sceneTypeList: UTSJSONObject[]
showScenePopup: boolean
showScenePopup: boolean
...
@@ -67,4 +61,10 @@ const tabs = HOME_FRAME_TABS;
...
@@ -67,4 +61,10 @@ const tabs = HOME_FRAME_TABS;
<style scoped lang="scss">
<style scoped lang="scss">
@import "./styles/common.scss";
@import "./styles/common.scss";
/* 与 layout-root 注入的 index.vars.uts 中 --tabbar-icon-size 一致;横屏侧栏见 TabbarLandscape .landscape-vertical-tabs__icon */
.tabbar-icon-img {
width: var(--tabbar-icon-size);
height: var(--tabbar-icon-size);
}
</style>
</style>
apps/uniappX/uniapp-x-tape/components/HomeFrame/index.uvue
View file @
058eb04
...
@@ -65,7 +65,7 @@
...
@@ -65,7 +65,7 @@
</template>
</template>
<script setup lang="uts">
<script setup lang="uts">
import { computed, defineExpose, ref } from "vue";
import { computed, defineExpose,
onMounted,
ref } from "vue";
import type { UnSwiperItem } from "@/uni_modules/uview-unix";
import type { UnSwiperItem } from "@/uni_modules/uview-unix";
...
@@ -235,7 +235,8 @@ function onStartClick(): void {
...
@@ -235,7 +235,8 @@ function onStartClick(): void {
emit("start");
emit("start");
}
}
onLoad((options) => {
onMounted((): void => {
requestRecordPermission();
requestRecordPermission();
});
});
defineExpose({
defineExpose({
...
...
apps/uniappX/uniapp-x-tape/components/HomeFrame/styles/common.scss
View file @
058eb04
...
@@ -454,6 +454,7 @@
...
@@ -454,6 +454,7 @@
pointer-events
:
none
;
pointer-events
:
none
;
}
}
.hf-landscape-column
,
.user-box
,
.user-box
,
.landscape-tabbar-wrap
,
.landscape-tabbar-wrap
,
.home-tabbar-footer
{
.home-tabbar-footer
{
...
@@ -464,6 +465,8 @@
...
@@ -464,6 +465,8 @@
.home-tabbar-landscape
{
.home-tabbar-landscape
{
min-height
:
0
;
min-height
:
0
;
height
:
100%
;
align-self
:
stretch
;
}
}
.home-tabbar-portrait
{
.home-tabbar-portrait
{
...
@@ -577,8 +580,9 @@
...
@@ -577,8 +580,9 @@
min-height
:
0
;
min-height
:
0
;
}
}
/* 横屏:footer 为侧栏第三段,由父级 flex 贴底;竖屏若复用此类名再按需加 margin */
.home-tabbar-footer
{
.home-tabbar-footer
{
margin-top
:
auto
;
flex-shrink
:
0
;
padding-bottom
:
40px
;
padding-bottom
:
40px
;
}
}
...
...
apps/uniappX/uniapp-x-tape/components/HomeFrame/styles/index.vars.uts
View file @
058eb04
...
@@ -85,8 +85,8 @@ export default {
...
@@ -85,8 +85,8 @@ export default {
'--common-title-height': '54px',
'--common-title-height': '54px',
'--entrance-icon-size': '64px',
'--entrance-icon-size': '64px',
'--entrance-item-gap': 'var(--l-spacing-3xl)',
'--entrance-item-gap': 'var(--l-spacing-3xl)',
'--tabbar-height': '
64
0px',
'--tabbar-height': '
7
0px',
'--tabbar-icon-size': '
34
px',
'--tabbar-icon-size': '
46
px',
'--tabbar-width': '140px',
'--tabbar-width': '140px',
},
},
...
@@ -126,7 +126,7 @@ export default {
...
@@ -126,7 +126,7 @@ export default {
'--entrance-icon-size': '64px',
'--entrance-icon-size': '64px',
'--entrance-item-gap': 'var(--l-spacing-3xl)',
'--entrance-item-gap': 'var(--l-spacing-3xl)',
'--tabbar-height': '70px',
'--tabbar-height': '70px',
'--tabbar-icon-size': '3
4
px',
'--tabbar-icon-size': '3
2
px',
},
},
}
}
}
}
apps/uniappX/uniapp-x-tape/components/HomeFrame/tabbarShared.uts
View file @
058eb04
import { computed, ref } from "vue";
import { computed, ref } from "vue";
import { cssClassRef } from "@/services/adapter";
import { storage } from "@/utils/storage.uts";
import { storage } from "@/utils/storage.uts";
import { notifyUserSceneTypeChanged } from "@/utils/userSceneEvents.uts";
import { notifyUserSceneTypeChanged } from "@/utils/userSceneEvents.uts";
import { hideNativeTabBar } from "@/utils/tabBarShell.uts";
import { hideNativeTabBar } from "@/utils/tabBarShell.uts";
export type HomeFrameTabbarSource = {
export type HomeFrameTabbarSource = {
getAdapterClass: () => null | string
getTabIndex: () => number
getTabIndex: () => number
getUserInfo: () => null | UTSJSONObject
getUserInfo: () => null | UTSJSONObject
}
}
/** SceneShell `provide`:`Ref<UTSJSONObject>`;MainTabShell `inject`,与插槽同源 */
export const SCENE_SHELL_USER_INFO_INJECT_KEY = "homeFrame.sceneShellUserInfo"
export type TabItem = {
export type TabItem = {
label: string;
label: string;
icon: string;
icon: string;
...
@@ -98,20 +99,6 @@ export function useHomeFrameTabbar(source: HomeFrameTabbarSource) {
...
@@ -98,20 +99,6 @@ export function useHomeFrameTabbar(source: HomeFrameTabbarSource) {
const showScenePopup = ref(false);
const showScenePopup = ref(false);
const showSetting = ref(false);
const showSetting = ref(false);
const adapterClassName = computed((): string => {
const cls = source.getAdapterClass();
if (cls != null && cls !== "") {
return cls as string;
}
const fromRef = cssClassRef.value;
return fromRef != null ? (fromRef as string) : "";
});
const isPadPortraitMode = computed((): boolean => {
const cls = adapterClassName.value;
return cls.indexOf("layout-portrait-768x1174") >= 0;
});
const currentTabIndex = computed((): number => {
const currentTabIndex = computed((): number => {
return source.getTabIndex();
return source.getTabIndex();
});
});
...
@@ -264,8 +251,6 @@ export function useHomeFrameTabbar(source: HomeFrameTabbarSource) {
...
@@ -264,8 +251,6 @@ export function useHomeFrameTabbar(source: HomeFrameTabbarSource) {
return {
return {
showScenePopup,
showScenePopup,
showSetting,
showSetting,
adapterClassName,
isPadPortraitMode,
currentTabIndex,
currentTabIndex,
sceneTypeList,
sceneTypeList,
sceneTypeIdList,
sceneTypeIdList,
...
...
apps/uniappX/uniapp-x-tape/pages.json
View file @
058eb04
...
@@ -13,24 +13,6 @@
...
@@ -13,24 +13,6 @@
}
}
},
},
{
{
"path"
:
"pages/usedCar/index"
,
"style"
:
{
"navigationStyle"
:
"custom"
}
},
{
"path"
:
"pages/equity/index"
,
"style"
:
{
"navigationStyle"
:
"custom"
}
},
{
"path"
:
"pages/boutique/index"
,
"style"
:
{
"navigationStyle"
:
"custom"
}
},
{
"path"
:
"pages/receptionCenter/center"
,
"path"
:
"pages/receptionCenter/center"
,
"style"
:
{
"style"
:
{
"navigationStyle"
:
"custom"
"navigationStyle"
:
"custom"
...
@@ -43,12 +25,6 @@
...
@@ -43,12 +25,6 @@
}
}
},
},
{
{
"path"
:
"pages/test/index"
,
"style"
:
{
"navigationStyle"
:
"custom"
}
},
{
"path"
:
"pages/index/index"
,
"path"
:
"pages/index/index"
,
"style"
:
{
"style"
:
{
"navigationStyle"
:
"custom"
,
"navigationStyle"
:
"custom"
,
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment