mirror of
https://github.com/cool-team-official/cool-admin-vue.git
synced 2025-12-16 16:42:50 +00:00
解决权限无法显示问题
This commit is contained in:
parent
43b3956640
commit
509719a643
@ -13,7 +13,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent, inject, ref, watch } from "vue";
|
import { defineComponent, ref, watch } from "vue";
|
||||||
|
import { useCool } from "/@/cool";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "cl-menu-perms",
|
name: "cl-menu-perms",
|
||||||
@ -28,7 +29,7 @@ export default defineComponent({
|
|||||||
emits: ["update:modelValue"],
|
emits: ["update:modelValue"],
|
||||||
|
|
||||||
setup(props, { emit }) {
|
setup(props, { emit }) {
|
||||||
const service = inject<any>("service");
|
const { service } = useCool();
|
||||||
|
|
||||||
// 绑定值
|
// 绑定值
|
||||||
const value = ref<any[]>([]);
|
const value = ref<any[]>([]);
|
||||||
@ -67,21 +68,23 @@ export default defineComponent({
|
|||||||
const col = (i: number, d: any[]) => {
|
const col = (i: number, d: any[]) => {
|
||||||
const key = arr[i];
|
const key = arr[i];
|
||||||
|
|
||||||
const index = d.findIndex((e: any) => e.label == key);
|
if (d) {
|
||||||
|
const index = d.findIndex((e: any) => e.label == key);
|
||||||
|
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
col(i + 1, d[index].children);
|
col(i + 1, d[index].children);
|
||||||
} else {
|
} else {
|
||||||
const isLast = i == arr.length - 1;
|
const isLast = i == arr.length - 1;
|
||||||
|
|
||||||
d.push({
|
d.push({
|
||||||
label: key,
|
label: key,
|
||||||
value: key,
|
value: key,
|
||||||
children: isLast ? null : []
|
children: isLast ? null : []
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!isLast) {
|
if (!isLast) {
|
||||||
col(i + 1, d[d.length - 1].children || []);
|
col(i + 1, d[d.length - 1].children || []);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user