1 Star 3 Fork 5

mmsAdmin/mms-ui

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
public
src
api
assets
components
animate
auth
auth.vue
authAll.vue
auths.vue
chat-room
city
cropper
fast-editor
fast-radio-checkbox
fast-radio-group
fast-select
fast-switch
fast-table-column
fast-upload
iconSelector
noticeBar
svg-icon
svgIcon
table-tool
table
directive
enums
hooks
i18n
icons
layout
router
stores
styles
theme
types
utils
views
App.vue
main.ts
.env
.env.development
.env.production
.eslintignore
.eslintrc.js
.gitignore
.gitmodules
.npmrc
.prettierrc.js
LICENSE
README.en.md
README.md
auto-imports.d.ts
components.d.ts
git-commit.bat
index.html
package.json
shims-vue.d.ts
tsconfig.json
vite.config.ts
vue-grid-layout.d.ts
windi.config.ts
克隆/下载
auths.vue 1.05 KB
一键复制 编辑 原始数据 按行查看 历史
xijue 提交于 4个月前 . 优化
<template>
<slot v-if="getUserAuthBtnList" />
</template>
<script setup lang="ts" name="auths">
import { computed } from 'vue';
import { storeToRefs } from 'pinia';
import { useUserInfo } from '/@/stores/userInfo';
import {Session} from "/@/utils/storage";
import {ElMessageBox} from "element-plus";
// 定义父组件传过来的值
const props = defineProps({
value: {
type: Array,
default: () => [],
},
});
// 定义变量内容
const stores = useUserInfo();
const { userInfos } = storeToRefs(stores);
// 获取 pinia 中的用户权限
const getUserAuthBtnList = computed(() => {
if(userInfos.value==null){
Session.remove("token");
window.location.href = '/'; // 去登录页
// eslint-disable-next-line vue/no-async-in-computed-properties
ElMessageBox.alert('登录失效,请重新登录', '提示', {})
.then(() => {})
.catch(() => {});
return ;
}
let flag = false;
userInfos.value.authBtnList.map((val: string) => {
props.value.map((v) => {
if (val === v) flag = true;
});
});
return flag;
});
</script>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mmsAdmin/mms-ui.git
git@gitee.com:mmsAdmin/mms-ui.git
mmsAdmin
mms-ui
mms-ui
master

搜索帮助