feat: 添加自定义导航栏组件和相关 composables

This commit is contained in:
Ray.Hao
2026-03-06 13:24:34 +08:00
parent 5bf7f0561f
commit da47f98fe9
30 changed files with 2831 additions and 551 deletions

View File

@@ -143,23 +143,26 @@ declare global {
const useId: typeof import('vue')['useId']
const useInterceptor: typeof import('@uni-helper/uni-use')['useInterceptor']
const useLink: (typeof import("vue-router"))["useLink"]
const useLoading: typeof import('@uni-helper/uni-use')['useLoading']
const useLoading: typeof import('../composables/useLoading')['useLoading']
const useManualTheme: typeof import('../composables/useTheme')['useManualTheme']
const useMessage: typeof import('wot-design-uni')['useMessage']
const useModal: typeof import('@uni-helper/uni-use')['useModal']
const useModel: typeof import('vue')['useModel']
const useNavbar: typeof import('../composables/useNavbar')['useNavbar']
const useNetwork: typeof import('@uni-helper/uni-use')['useNetwork']
const useNotify: typeof import('wot-design-uni')['useNotify']
const useOnline: typeof import('@uni-helper/uni-use')['useOnline']
const usePage: typeof import('@uni-helper/uni-use')['usePage']
const usePageLayout: typeof import('../composables/useNavbar')['usePageLayout']
const usePageScroll: typeof import('@uni-helper/uni-use')['usePageScroll']
const usePages: typeof import('@uni-helper/uni-use')['usePages']
const usePagination: typeof import('../composables/useRequest')['usePagination']
const usePreferredDark: typeof import('@uni-helper/uni-use')['usePreferredDark']
const usePreferredLanguage: typeof import('@uni-helper/uni-use')['usePreferredLanguage']
const usePrevPage: typeof import('@uni-helper/uni-use')['usePrevPage']
const usePrevRoute: typeof import('@uni-helper/uni-use')['usePrevRoute']
const useProvider: typeof import('@uni-helper/uni-use')['useProvider']
const useRequest: typeof import('@uni-helper/uni-use')['useRequest']
const useRequest: typeof import('../composables/useRequest')['useRequest']
const useRoute: typeof import('uni-mini-router')['useRoute']
const useRouter: typeof import('uni-mini-router')['useRouter']
const useScanCode: typeof import('@uni-helper/uni-use')['useScanCode']
@@ -174,10 +177,10 @@ declare global {
const useTabbar: typeof import('../composables/useTabbar')['useTabbar']
const useTemplateRef: typeof import('vue')['useTemplateRef']
const useTheme: typeof import('../composables/useTheme')['useTheme']
const useThemeStore: typeof import('../store/modules/theme-store')['useThemeStore']
const useThemeStore: typeof import('../store/modules/theme')['useThemeStore']
const useToast: typeof import('wot-design-uni')['useToast']
const useUploadFile: typeof import('@uni-helper/uni-use')['useUploadFile']
const useUserStore: typeof import('../store/modules/user-store')['useUserStore']
const useUserStore: typeof import('../store/modules/user')['useUserStore']
const useVisible: typeof import('@uni-helper/uni-use')['useVisible']
const user: typeof import('../api/user')['default']
const watch: typeof import('vue')['watch']
@@ -306,9 +309,13 @@ declare module 'vue' {
readonly useCssModule: UnwrapRef<typeof import('vue')['useCssModule']>
readonly useCssVars: UnwrapRef<typeof import('vue')['useCssVars']>
readonly useId: UnwrapRef<typeof import('vue')['useId']>
readonly useLoading: UnwrapRef<typeof import('../composables/useLoading')['useLoading']>
readonly useMessage: UnwrapRef<typeof import('wot-design-uni')['useMessage']>
readonly useModel: UnwrapRef<typeof import('vue')['useModel']>
readonly useNavbar: UnwrapRef<typeof import('../composables/useNavbar')['useNavbar']>
readonly useNotify: UnwrapRef<typeof import('wot-design-uni')['useNotify']>
readonly usePagination: UnwrapRef<typeof import('../composables/useRequest')['usePagination']>
readonly useRequest: UnwrapRef<typeof import('../composables/useRequest')['useRequest']>
readonly useRoute: UnwrapRef<typeof import('uni-mini-router')['useRoute']>
readonly useRouter: UnwrapRef<typeof import('uni-mini-router')['useRouter']>
readonly useSlots: UnwrapRef<typeof import('vue')['useSlots']>
@@ -316,9 +323,9 @@ declare module 'vue' {
readonly useTabbar: UnwrapRef<typeof import('../composables/useTabbar')['useTabbar']>
readonly useTemplateRef: UnwrapRef<typeof import('vue')['useTemplateRef']>
readonly useTheme: UnwrapRef<typeof import('../composables/useTheme')['useTheme']>
readonly useThemeStore: UnwrapRef<typeof import('../store/modules/theme-store')['useThemeStore']>
readonly useThemeStore: UnwrapRef<typeof import('../store/modules/theme')['useThemeStore']>
readonly useToast: UnwrapRef<typeof import('wot-design-uni')['useToast']>
readonly useUserStore: UnwrapRef<typeof import('../store/modules/user-store')['useUserStore']>
readonly useUserStore: UnwrapRef<typeof import('../store/modules/user')['useUserStore']>
readonly user: UnwrapRef<typeof import('../api/user')['default']>
readonly watch: UnwrapRef<typeof import('vue')['watch']>
readonly watchEffect: UnwrapRef<typeof import('vue')['watchEffect']>

226
src/types/uni-components.d.ts vendored Normal file
View File

@@ -0,0 +1,226 @@
/**
* uni-app 原生组件类型声明
*
* 解决 Volar 对原生组件属性的类型检查问题
* 这些类型声明扩展了 @uni-helper/uni-types 的基础类型
*/
// 扩展 uni-app 原生组件属性类型
declare module "@vue/runtime-core" {
export interface GlobalComponents {
view: new () => {
$props: {
class?: string
style?: string | Record<string, any>
hoverClass?: string
hoverStartTime?: number
hoverStayTime?: number
hoverStopPropagation?: boolean
onClick?: (event: any) => void
}
}
text: new () => {
$props: {
class?: string
style?: string | Record<string, any>
selectable?: boolean
userSelect?: boolean
space?: "ensp" | "emsp" | "nbsp"
decode?: boolean
onClick?: (event: any) => void
}
}
image: new () => {
$props: {
class?: string
style?: string | Record<string, any>
src?: string
mode?:
| "scaleToFill"
| "aspectFit"
| "aspectFill"
| "widthFix"
| "heightFix"
| "top"
| "bottom"
| "center"
| "left"
| "right"
| "top left"
| "top right"
| "bottom left"
| "bottom right"
lazyLoad?: boolean
fadeShow?: boolean
webp?: boolean
showMenuByLongpress?: boolean
onClick?: (event: any) => void
}
}
button: new () => {
$props: {
class?: string
style?: string | Record<string, any>
size?: "default" | "mini"
type?: "primary" | "default" | "warn"
plain?: boolean
disabled?: boolean
loading?: boolean
formType?: "submit" | "reset"
openType?:
| "feedback"
| "share"
| "getUserInfo"
| "contact"
| "getPhoneNumber"
| "launchApp"
| "openSetting"
| "getAuthorize"
| "contactShare"
| "livestream"
| "getRealnameAuthInfo"
hoverClass?: string
hoverStartTime?: number
hoverStayTime?: number
lang?: "en" | "zh_CN" | "zh_TW"
sessionFrom?: string
sendMessageTitle?: string
sendMessagePath?: string
sendMessageImg?: string
showMessageCard?: boolean
appParameter?: string
onClick?: (event: any) => void
onGetphonenumber?: (event: any) => void
onGetuserinfo?: (event: any) => void
onContact?: (event: any) => void
onError?: (event: any) => void
onOpensetting?: (event: any) => void
onLaunchapp?: (event: any) => void
}
}
input: new () => {
$props: {
class?: string
style?: string | Record<string, any>
value?: string
type?: "text" | "number" | "idcard" | "digit" | "safe-password" | "nickname"
password?: boolean
placeholder?: string
placeholderStyle?: string
placeholderClass?: string
disabled?: boolean
maxlength?: number | string
cursorSpacing?: number
autoFocus?: boolean
focus?: boolean
cursor?: number
selectionStart?: number
selectionEnd?: number
adjustPosition?: boolean
holdKeyboard?: boolean
alwaysEmbed?: boolean
confirmType?: "send" | "search" | "next" | "go" | "done"
confirmHold?: boolean
onInput?: (event: any) => void
onFocus?: (event: any) => void
onBlur?: (event: any) => void
onConfirm?: (event: any) => void
}
}
textarea: new () => {
$props: {
class?: string
style?: string | Record<string, any>
value?: string
placeholder?: string
placeholderStyle?: string
placeholderClass?: string
disabled?: boolean
maxlength?: number | string
autoFocus?: boolean
focus?: boolean
autoHeight?: boolean
fixed?: boolean
cursorSpacing?: number
cursor?: number
showConfirmBar?: boolean
selectionStart?: number
selectionEnd?: number
adjustPosition?: boolean
holdKeyboard?: boolean
disableDefaultPadding?: boolean
confirmType?: "send" | "search" | "next" | "go" | "done"
confirmHold?: boolean
onInput?: (event: any) => void
onFocus?: (event: any) => void
onBlur?: (event: any) => void
onConfirm?: (event: any) => void
onLinechange?: (event: any) => void
}
}
scrollview: new () => {
$props: {
class?: string
style?: string | Record<string, any>
scrollX?: boolean
scrollY?: boolean
upperThreshold?: number
lowerThreshold?: number
scrollTop?: number | string
scrollLeft?: number | string
scrollIntoView?: string
scrollWithAnimation?: boolean
enableBackToTop?: boolean
enableFlex?: boolean
scrollAnchors?: boolean
refresherEnabled?: boolean
refresherThreshold?: number
refresherDefaultStyle?: "black" | "white" | "none"
refresherBackground?: string
refresherTriggered?: boolean
enhanced?: boolean
bounces?: boolean
showScrollbar?: boolean
pagingEnabled?: boolean
fastDeceleration?: boolean
onScrolltoupper?: (event: any) => void
onScrolltolower?: (event: any) => void
onScroll?: (event: any) => void
onRefresherrefresh?: (event: any) => void
onRefresherrestore?: (event: any) => void
onRefresherabort?: (event: any) => void
}
}
swiper: new () => {
$props: {
class?: string
style?: string | Record<string, any>
indicatorDots?: boolean
indicatorColor?: string
indicatorActiveColor?: string
autoplay?: boolean
current?: number
interval?: number
duration?: number
circular?: boolean
vertical?: boolean
previousMargin?: string
nextMargin?: string
displayMultipleItems?: number
skipHiddenItemLayout?: boolean
easingFunction?: "default" | "linear" | "easeInCubic" | "easeOutCubic" | "easeInOutCubic"
onChange?: (event: any) => void
onTransition?: (event: any) => void
onAnimationfinish?: (event: any) => void
}
}
swiperitem: new () => {
$props: {
class?: string
style?: string | Record<string, any>
}
}
}
}
export {}

View File

@@ -15,8 +15,11 @@ interface NavigateToOptions {
"/pages/mine/profile/index" |
"/pages/mine/settings/index" |
"/pages/work/config/index" |
"/pages/work/dept/index" |
"/pages/work/log/index" |
"/pages/work/menu/index" |
"/pages/work/notice/index" |
"/pages/work/permission/index" |
"/pages/work/role/index" |
"/pages/work/user/index" |
"/pages/mine/settings/account/index" |