index.vue
1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<template>
<el-button
v-if="hasPermission()"
:type="type"
:icon="icon"
:loading="loading"
:disabled="disabled"
size="small"
@click="clickEvent"
>
<slot />
</el-button>
</template>
<script>
export default {
name: 'AuthButton',
props: {
uid: {
type: [String, Number],
default: ''
},
type: {
type: [String, Number],
default: 'default'
},
link: {
type: Boolean,
default: false
},
icon: {
type: String,
default: ''
},
loading: {
type: Boolean,
default: false
},
disabled: {
type: Boolean,
default: false
},
url: {
type: String,
default: ''
}
},
data() {
return {
currentPath: this.$route.path
}
},
mounted() {},
methods: {
// 判断是否有权限
hasPermission() {
const id = this.uid
const list = this.$Common.filterAsycRouter(
this.$store.getters.asycRouters,
this.url || this.currentPath
)
const idx = list.findIndex((k) => k.rightDes == id)
if (idx < 0) {
return false
} else {
return true
}
},
// 点击事件
clickEvent() {
this.$emit('click')
}
}
}
</script>
<style lang="scss" scoped>
</style>