常用组件移除功能优化

This commit is contained in:
不做码农 2023-05-10 11:51:32 +08:00
parent bdd774dcd4
commit 56117efda3

View File

@ -1,8 +1,8 @@
<template> <template>
<div class="tool-wrap"> <div class="tool-wrap">
<template v-for="item in commonRouters"> <template v-for="item in commonRouters">
<div class="tool-item"> <div class="tool-item" @mouseenter="onMouseOver(item)" @mouseleave="onMouseOut(item)">
<span class="close-used" @click="removeRoute(item)" v-if="showRemove"> <span class="close-used" @click="removeRoute(item)" v-if="item.hidden">
<el-icon><CloseBold /></el-icon> <el-icon><CloseBold /></el-icon>
</span> </span>
<router-link :to="item.path"> <router-link :to="item.path">
@ -35,27 +35,15 @@ watch(
) )
const commonRouters = computed(() => usePermissionStore().commonlyUsedRoutes) const commonRouters = computed(() => usePermissionStore().commonlyUsedRoutes)
// const { proxy } = getCurrentInstance()
// const menuList = ref([
// { path: '/dashboard', title: '', color: '#40c9c6', name: 'dashboard' },
// { path: '/tool/gen', title: '', color: '#40c9c6', name: 'code', perms: ['tool:gen:list'] },
// { path: '/tool/file', title: '', color: '#6A5ACD', name: 'upload', perms: ['tool:file:list'] },
// // // { path: '/system/user', title: '', color: '#7FFF00', name: 'peoples' },
// { path: '/system/dict', title: '', color: '#B0E0E6', name: 'dict', perms: ['system:dict:list'] },
// { path: '/monitor/job', title: '', color: '#D2691E', name: 'job', perms: ['monitor:job:list'] },
// { path: '/system/log/operlog', title: '', color: '#D2691E', name: 'form', perms: ['monitor:operlog:list'] }
// // { path: '/system/log/logininfor', title: '', color: '#D2691E', name: 'logininfor' }
// ])
// function checkPermi(v) {
// if (v && v.perms) {
// return proxy.$auth.hasPermiOr(v.perms)
// }
// return true
// }
function removeRoute(item) { function removeRoute(item) {
usePermissionStore().removeCommonlyUsedRoutes(item) usePermissionStore().removeCommonlyUsedRoutes(item)
} }
function onMouseOver(item) {
item.hidden = true
}
function onMouseOut(item) {
item.hidden = false
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.tool-wrap { .tool-wrap {