fix : 菜单显示问题
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user