-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
196 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { useStore } from '@/store' | ||
import { computed } from 'vue' | ||
|
||
export const getAppCollapseMenu = () => { | ||
const store = useStore() | ||
const isCollapseMenu = computed(() => store.getters.collapseMenu) | ||
return isCollapseMenu | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { ComponentInternalInstance, getCurrentInstance } from 'vue' | ||
|
||
export function useCurrentInstance() { | ||
const { appContext } = getCurrentInstance() as ComponentInternalInstance | ||
const globalProperties = appContext.config.globalProperties | ||
return { | ||
globalProperties, | ||
} | ||
} | ||
|
||
export function getProxy() { | ||
const { proxy } = getCurrentInstance() as ComponentInternalInstance | ||
return { | ||
proxy, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { Module } from 'vuex' | ||
|
||
const actionTypes = {} | ||
|
||
const mutationTypes = { | ||
SET_COLLAPSEMENU: 'SET_COLLAPSEMENU', | ||
} | ||
|
||
interface StoreUser { | ||
collapseMenu: boolean | ||
} | ||
|
||
const store: Module<StoreUser, unknown> = { | ||
namespaced: false, // 是否加上所属的模块名 | ||
state() { | ||
return { | ||
collapseMenu: false, | ||
} | ||
}, | ||
mutations: { | ||
[mutationTypes.SET_COLLAPSEMENU](state: StoreUser, payload: boolean) { | ||
state.collapseMenu = payload | ||
localStorage.setItem('appCollapseMenu', JSON.stringify(payload)) | ||
}, | ||
}, | ||
actions: {}, | ||
getters: { | ||
collapseMenu: (state) => state.collapseMenu, | ||
}, | ||
} | ||
|
||
export { actionTypes, mutationTypes } | ||
|
||
export default store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters