diff --git a/package.json b/package.json
index d4bb711..0ff3a07 100755
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "v3-admin",
- "version": "3.0.7",
+ "version": "3.1.0-rc.1",
"homepage": "https://github.com/un-pany/v3-admin",
"scripts": {
"dev": "vue-cli-service serve",
@@ -21,10 +21,10 @@
"normalize.css": "^8.0.1",
"nprogress": "^0.2.0",
"path-to-regexp": "^6.2.0",
+ "pinia": "^2.0.12",
"screenfull": "^6.0.1",
"vue": "^3.2.31",
- "vue-router": "^4.0.14",
- "vuex": "^4.0.2"
+ "vue-router": "^4.0.14"
},
"devDependencies": {
"@types/js-cookie": "^3.0.1",
diff --git a/src/App.vue b/src/App.vue
index c44865e..251a462 100755
--- a/src/App.vue
+++ b/src/App.vue
@@ -7,6 +7,9 @@
diff --git a/src/components/theme-switch/index.vue b/src/components/theme-switch/index.vue
index 02e03c4..e8afc36 100644
--- a/src/components/theme-switch/index.vue
+++ b/src/components/theme-switch/index.vue
@@ -23,15 +23,16 @@
diff --git a/src/directives/permission/index.ts b/src/directives/permission/index.ts
index 1e90d54..60965c4 100755
--- a/src/directives/permission/index.ts
+++ b/src/directives/permission/index.ts
@@ -1,11 +1,11 @@
-import { store } from '@/store'
+import { useUserStoreHook } from '@/store/modules/user'
import { Directive } from 'vue'
/** 权限指令 */
export const permission: Directive = {
mounted(el, binding) {
const { value } = binding
- const roles = store.state.user.roles
+ const roles = useUserStoreHook().roles
if (value && value instanceof Array && value.length > 0) {
const permissionRoles = value
const hasPermission = roles.some((role: any) => {
@@ -15,7 +15,7 @@ export const permission: Directive = {
el.style.display = 'none'
}
} else {
- throw new Error('need roles! Like v-permission="[\'admin\',\'editor\']"')
+ throw new Error("need roles! Like v-permission=\"['admin','editor']\"")
}
}
}
diff --git a/src/layout/components/navigation-bar/index.vue b/src/layout/components/navigation-bar/index.vue
index e2a7dc9..78e2234 100644
--- a/src/layout/components/navigation-bar/index.vue
+++ b/src/layout/components/navigation-bar/index.vue
@@ -36,28 +36,33 @@
import { UserFilled } from '@element-plus/icons-vue'
import { computed, reactive } from 'vue'
import { useRouter } from 'vue-router'
-import { store } from '@/store'
+import { useAppStore } from '@/store/modules/app'
+import { useSettingsStore } from '@/store/modules/settings'
+import { useUserStore } from '@/store/modules/user'
import BreadCrumb from '../bread-crumb/index.vue'
import Hamburger from '../hamburger/index.vue'
import ThemeSwitch from '@/components/theme-switch/index.vue'
import Screenfull from '@/components/screenfull/index.vue'
const router = useRouter()
+const appStore = useAppStore()
+const settingsStore = useSettingsStore()
+const userStore = useUserStore()
const sidebar = computed(() => {
- return store.state.app.sidebar
+ return appStore.sidebar
})
const showThemeSwitch = computed(() => {
- return store.state.settings.showThemeSwitch
+ return settingsStore.showThemeSwitch
})
const showScreenfull = computed(() => {
- return store.state.settings.showScreenfull
+ return settingsStore.showScreenfull
})
const state = reactive({
toggleSideBar: () => {
- store.commit('app/TOGGLE_SIDEBAR', false)
+ appStore.toggleSidebar(false)
},
logout: () => {
- store.dispatch('user/logout')
+ userStore.logout()
router.push('/login').catch((err) => {
console.warn(err)
})
diff --git a/src/layout/components/settings/index.vue b/src/layout/components/settings/index.vue
index 7ff3883..fdc2485 100755
--- a/src/layout/components/settings/index.vue
+++ b/src/layout/components/settings/index.vue
@@ -30,21 +30,23 @@
diff --git a/yarn.lock b/yarn.lock
index 3d96134..cab3c9b 100755
--- a/yarn.lock
+++ b/yarn.lock
@@ -1817,11 +1817,16 @@
optionalDependencies:
prettier "^1.18.2 || ^2.0.0"
-"@vue/devtools-api@^6.0.0", "@vue/devtools-api@^6.0.0-beta.11":
+"@vue/devtools-api@^6.0.0":
version "6.1.0"
resolved "https://registry.npmmirror.com/@vue/devtools-api/-/devtools-api-6.1.0.tgz#5b7945e656bc0f85b1774c9aca1dbe075bead3c0"
integrity sha512-1FtbxEEHN70WGJl1b/h8nLmyN+tOHONNsNLvgVEXF/L/vBrRqQZ0kF+dev1YAz3OtxsQ1sV/vPLKwRlq1axrgg==
+"@vue/devtools-api@^6.1.0":
+ version "6.1.4"
+ resolved "https://registry.npmmirror.com/@vue/devtools-api/-/devtools-api-6.1.4.tgz#b4aec2f4b4599e11ba774a50c67fa378c9824e53"
+ integrity sha512-IiA0SvDrJEgXvVxjNkHPFfDx6SXw0b/TUkqMcDZWNg9fnCAHbTpoo59YfJ9QLFkwa3raau5vSlRVzMSLDnfdtQ==
+
"@vue/eslint-config-standard@^6.1.0":
version "6.1.0"
resolved "https://registry.npmmirror.com/@vue/eslint-config-standard/-/eslint-config-standard-6.1.0.tgz#b362ba67c86caa4e7b44481c2303c9dccc2dc037"
@@ -5990,6 +5995,14 @@ pidtree@^0.5.0:
resolved "https://registry.npmmirror.com/pidtree/-/pidtree-0.5.0.tgz#ad5fbc1de78b8a5f99d6fbdd4f6e4eee21d1aca1"
integrity sha512-9nxspIM7OpZuhBxPg73Zvyq7j1QMPMPsGKTqRc2XOaFQauDvoNz9fM1Wdkjmeo7l9GXOZiRs97sPkuayl39wjA==
+pinia@^2.0.12:
+ version "2.0.12"
+ resolved "https://registry.npmmirror.com/pinia/-/pinia-2.0.12.tgz#4c6f7f59cb41f56f20deee71c403e66d8d3c637d"
+ integrity sha512-tUeuYGFrLU5irmGyRAIxp35q1OTcZ8sKpGT4XkPeVcG35W4R6cfXDbCGexzmVqH5lTQJJTXXbNGutIu9yS5yew==
+ dependencies:
+ "@vue/devtools-api" "^6.1.0"
+ vue-demi "*"
+
pkg-dir@^4.1.0:
version "4.2.0"
resolved "https://registry.npmmirror.com/pkg-dir/-/pkg-dir-4.2.0.tgz#f099133df7ede422e81d1d8448270eeb3e4261f3"
@@ -7813,13 +7826,6 @@ vue@^3.2.31:
"@vue/server-renderer" "3.2.31"
"@vue/shared" "3.2.31"
-vuex@^4.0.2:
- version "4.0.2"
- resolved "https://registry.npmmirror.com/vuex/-/vuex-4.0.2.tgz#f896dbd5bf2a0e963f00c67e9b610de749ccacc9"
- integrity sha512-M6r8uxELjZIK8kTKDGgZTYX/ahzblnzC4isU1tpmEuOIIKmV+TRdc+H4s8ds2NuZ7wpUTdGRzJRtoj+lI+pc0Q==
- dependencies:
- "@vue/devtools-api" "^6.0.0-beta.11"
-
watchpack@^2.3.1:
version "2.3.1"
resolved "https://registry.npmmirror.com/watchpack/-/watchpack-2.3.1.tgz#4200d9447b401156eeca7767ee610f8809bc9d25"