使用Pinia代替Vuex进行数据存储

This commit is contained in:
不做码农
2022-06-11 10:33:49 +08:00
parent ef604d008d
commit 859f8acfe2
41 changed files with 700 additions and 797 deletions
+23 -23
View File
@@ -1,28 +1,28 @@
/**
* v-hasPermi 操作权限处理
* Copyright (c) 2019 ruoyi
*/
import store from '@/store'
* v-hasPermi 操作权限处理
* Copyright (c) 2019 ruoyi
*/
export default {
mounted(el, binding, vnode) {
const { value } = binding
const all_permission = "*:*:*";
const permissions = store.getters && store.getters.permissions
import useUserStore from '@/store/modules/user'
if (value && value instanceof Array && value.length > 0) {
const permissionFlag = value
export default {
mounted(el, binding, vnode) {
const { value } = binding
const all_permission = "*:*:*";
const permissions = useUserStore().permissions
const hasPermissions = permissions.some(permission => {
return all_permission === permission || permissionFlag.includes(permission)
})
if (value && value instanceof Array && value.length > 0) {
const permissionFlag = value
if (!hasPermissions) {
el.parentNode && el.parentNode.removeChild(el)
}
} else {
throw new Error(`请设置操作权限标签值`)
}
}
}
const hasPermissions = permissions.some(permission => {
return all_permission === permission || permissionFlag.includes(permission)
})
if (!hasPermissions) {
el.parentNode && el.parentNode.removeChild(el)
}
} else {
throw new Error(`请设置操作权限标签值`)
}
}
}
+2 -2
View File
@@ -3,13 +3,13 @@
* Copyright (c) 2019 ruoyi
*/
import store from '@/store'
import useUserStore from '@/store/modules/user'
export default {
mounted(el, binding, vnode) {
const { value } = binding
const super_admin = "admin";
const roles = store.getters && store.getters.roles
const roles = useUserStore().roles
if (value && value instanceof Array && value.length > 0) {
const roleFlag = value