1
0
mirror of https://github.com/chatopera/cosin.git synced 2025-08-01 16:38:02 +08:00

add: navigate module

Signed-off-by: Kaifuny <superbiger.github@gmail.com>
This commit is contained in:
Kaifuny 2023-07-24 16:27:00 +08:00
parent 8b1a0dbe94
commit f32879cada
5 changed files with 43 additions and 1 deletions

View File

@ -8,3 +8,15 @@
* module 为模块,一个模块对应一个 store一个 store 对应一个模块
* action 为模块的 action一个 action 对应一个执行命令指令 (通常以 ``do`` 开头)
* getter 为模块的 getter一个 getter 对应一个获取命令指令 (通常以 ``get / is`` 开头)
参照:
module 与 action 的关系应该类似于, 模块名 类似于 npm 执行命令install 行为对应 actions, xxx 为actions的参数
```
npm install xxx
```
module 与 getters 的关系应该类似于
```
npm --version
```

View File

@ -2,7 +2,7 @@ import { defineStore } from 'pinia'
import { Apperance } from '@cskefu/models'
import { useStorage } from '@vueuse/core'
export const useApperance = defineStore('alerts', {
export const useApperance = defineStore('apperance', {
state: () => ({
apperance: useStorage<Apperance>('apperance', {
lang: 'zh-CN',

View File

@ -0,0 +1,12 @@
import { defineStore } from 'pinia'
export const useApperance = defineStore('auth', {
state: () => ({
currentUser: {},
}),
actions: {
doLogin() {},
doLogout() {},
doSocialLogin() {},
},
})

View File

@ -0,0 +1,18 @@
import { defineStore } from 'pinia'
export const useApperance = defineStore('auth', {
state: () => ({
currentPathName: '',
}),
actions: {
doWindowOpen(url: string, target?: string, features?: string) {
window.open(url, target, features)
},
doRouteToByServiceName(serviceName: string) {
console.log(serviceName)
},
doRouteToByPathName(path: string) {
this.currentPathName = path
},
},
})