refactor: update v-model bindings and emit event names for favorites and breadcrumb visibility
This commit is contained in:
@@ -8,11 +8,11 @@ type ToggleSidebarPayload = {
|
||||
|
||||
type UseAdminLayoutStateOptions = {
|
||||
appBarRef: Ref<unknown>
|
||||
breadcrumbBarVisible: boolean | null
|
||||
breadcrumbBarVisible: Ref<boolean | null>
|
||||
emitUpdateBreadcrumbBarVisible: (value: boolean) => void
|
||||
emitUpdateFavoritesBarVisible: (value: boolean) => void
|
||||
emitUpdateIsRail: (value: boolean) => void
|
||||
favoritesBarVisible: boolean | null
|
||||
favoritesBarVisible: Ref<boolean | null>
|
||||
isMobile: Ref<boolean>
|
||||
isRail: Ref<boolean | null> // 必須為 Ref,確保父層 prop 更新時 getter 能即時反映
|
||||
menuItems: AdminLayoutMenuItem[]
|
||||
@@ -42,9 +42,9 @@ export function useAdminLayoutState(options: UseAdminLayoutStateOptions) {
|
||||
})
|
||||
|
||||
const showFavoritesBar = computed({
|
||||
get: () => options.favoritesBarVisible ?? localFavoritesBarVisible.value,
|
||||
get: () => options.favoritesBarVisible.value ?? localFavoritesBarVisible.value,
|
||||
set: (value: boolean) => {
|
||||
if (options.favoritesBarVisible === null) {
|
||||
if (options.favoritesBarVisible.value === null) {
|
||||
localFavoritesBarVisible.value = value
|
||||
return
|
||||
}
|
||||
@@ -54,9 +54,9 @@ export function useAdminLayoutState(options: UseAdminLayoutStateOptions) {
|
||||
})
|
||||
|
||||
const breadcrumbBarVisible = computed({
|
||||
get: () => options.breadcrumbBarVisible ?? localBreadcrumbBarVisible.value,
|
||||
get: () => options.breadcrumbBarVisible.value ?? localBreadcrumbBarVisible.value,
|
||||
set: (value: boolean) => {
|
||||
if (options.breadcrumbBarVisible === null) {
|
||||
if (options.breadcrumbBarVisible.value === null) {
|
||||
localBreadcrumbBarVisible.value = value
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user