fix : 菜单显示问题

This commit is contained in:
邓洁
2023-12-29 23:42:53 +08:00
parent 182b29bb17
commit 4430b9c651
2 changed files with 204 additions and 168 deletions

View File

@@ -1,6 +1,6 @@
<template>
<div class="manage-btn">
<div v-for="(item,index) in btnList" :key="item.name" class="btn-box" @click="select(item,index)">
<div v-for="(item,index) in list" :key="item.name" class="btn-box" @click="select(item,index)">
<div :style="{ backgroundImage:'url(' +getImageUrl(item.icon)+')' }"></div>
<div :class="{'select-active':selectButton===index}">{{ item.name }}</div>
</div>
@@ -18,17 +18,17 @@ const props = defineProps({
default: []
},
})
watch(() => props.list, (now) => {
let newArr=[]
btnList.value.forEach((btnList) => {
now.forEach((item) => {
if (btnList.route==item) {
newArr.push(btnList)
}
})
})
btnList.value=newArr
}, {deep: true});
// watch(() => props.list, (now) => {
// let newArr=[]
// btnList.value.forEach((btnList) => {
// now.forEach((item) => {
// if (btnList.route==item) {
// newArr.push(btnList)
// }
// })
// })
// btnList.value=newArr
// }, {deep: true});
const emit = defineEmits(["update:modelValue", "select"]);
const btnList = ref([
{
@@ -56,6 +56,7 @@ const btnList = ref([
// name: '模拟仿真'
// },
])
const newList=ref([])
const selectButton = ref(props.modelValue);
const getImageUrl = (name) => {
return new URL(`../../assets/images/topAndDown/${name}`, import.meta.url).href