Skip to content

Commit 509719a

Browse files
committed
解决权限无法显示问题
1 parent 43b3956 commit 509719a

File tree

1 file changed

+17
-14
lines changed
  • src/cool/modules/base/components/menu

1 file changed

+17
-14
lines changed

src/cool/modules/base/components/menu/perms.vue

+17-14
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
</template>
1414

1515
<script lang="ts">
16-
import { defineComponent, inject, ref, watch } from "vue";
16+
import { defineComponent, ref, watch } from "vue";
17+
import { useCool } from "/@/cool";
1718
1819
export default defineComponent({
1920
name: "cl-menu-perms",
@@ -28,7 +29,7 @@ export default defineComponent({
2829
emits: ["update:modelValue"],
2930
3031
setup(props, { emit }) {
31-
const service = inject<any>("service");
32+
const { service } = useCool();
3233
3334
// 绑定值
3435
const value = ref<any[]>([]);
@@ -67,21 +68,23 @@ export default defineComponent({
6768
const col = (i: number, d: any[]) => {
6869
const key = arr[i];
6970
70-
const index = d.findIndex((e: any) => e.label == key);
71+
if (d) {
72+
const index = d.findIndex((e: any) => e.label == key);
7173
72-
if (index >= 0) {
73-
col(i + 1, d[index].children);
74-
} else {
75-
const isLast = i == arr.length - 1;
74+
if (index >= 0) {
75+
col(i + 1, d[index].children);
76+
} else {
77+
const isLast = i == arr.length - 1;
7678
77-
d.push({
78-
label: key,
79-
value: key,
80-
children: isLast ? null : []
81-
});
79+
d.push({
80+
label: key,
81+
value: key,
82+
children: isLast ? null : []
83+
});
8284
83-
if (!isLast) {
84-
col(i + 1, d[d.length - 1].children || []);
85+
if (!isLast) {
86+
col(i + 1, d[d.length - 1].children || []);
87+
}
8588
}
8689
}
8790
};

0 commit comments

Comments
 (0)