mirror of
https://github.com/ialley-workshop-open/uni-halo.git
synced 2026-11-13 22:11:42 +08:00
refactor: 重构偏好设置模块,新增全局设置弹窗与通用hook
1. 抽离usePreferenceRows通用hook,统一管理偏好设置的字段定义、状态读写与交互逻辑 2. 新增全局操作组件与全局设置弹窗,替换原有的滚动到顶部组件 3. 重构页面端偏好设置页面,复用通用hook减少重复代码 4. 修复并优化了原有组件的页面适配逻辑
This commit is contained in:
+26
-30
@@ -1,37 +1,33 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import FgTabbar from '@/tabbar/index.vue'
|
||||
import { isPageTabbar } from './tabbar/store'
|
||||
import { currRoute } from './utils'
|
||||
import { ref } from 'vue'
|
||||
import { isPageTabbar } from './tabbar/store'
|
||||
import { currRoute } from './utils'
|
||||
import CustomTabbar from '@/tabbar/index.vue'
|
||||
|
||||
const isCurrentPageTabbar = ref(true)
|
||||
onShow(() => {
|
||||
const { path } = currRoute()
|
||||
// “蜡笔小开心”提到本地是 '/pages/index/index',线上是 '/' 导致线上 tabbar 不见了
|
||||
// 所以这里需要判断一下,如果是 '/' 就当做首页,也要显示 tabbar
|
||||
if (path === '/') {
|
||||
isCurrentPageTabbar.value = true
|
||||
}
|
||||
else {
|
||||
isCurrentPageTabbar.value = isPageTabbar(path)
|
||||
}
|
||||
})
|
||||
|
||||
const helloKuRoot = ref('Hello AppKuVue')
|
||||
|
||||
const exposeRef = ref('this is form app.Ku.vue')
|
||||
|
||||
defineExpose({
|
||||
exposeRef,
|
||||
})
|
||||
const isCurrentPageTabbar = ref(true)
|
||||
const globalSettingsVisible = ref(false)
|
||||
onShow(() => {
|
||||
const { path } = currRoute()
|
||||
if (path === '/') {
|
||||
isCurrentPageTabbar.value = true
|
||||
}
|
||||
else {
|
||||
isCurrentPageTabbar.value = isPageTabbar(path)
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view>
|
||||
<uh-scroll-top />
|
||||
<view>
|
||||
<uh-global-actions>
|
||||
<uh-scrolltop-button :fixed="false"/>
|
||||
<uh-settings-button :fixed="false" @click="globalSettingsVisible = !globalSettingsVisible"/>
|
||||
</uh-global-actions>
|
||||
|
||||
<uh-settings-popup v-model="globalSettingsVisible" @close="globalSettingsVisible = false" />
|
||||
|
||||
<KuRootView />
|
||||
<KuRootView />
|
||||
|
||||
<FgTabbar v-if="isCurrentPageTabbar" />
|
||||
</view>
|
||||
</template>
|
||||
<CustomTabbar v-if="isCurrentPageTabbar" />
|
||||
</view>
|
||||
</template>
|
||||
Reference in New Issue
Block a user