功能菜单组件,之前选中过切换菜单再回来后默认选中但是组件不显示问题修改

main
zhufu 2025-05-06 16:15:34 +08:00
parent 43b8feed9a
commit 489b0bc051
1 changed files with 7 additions and 4 deletions

View File

@ -12,7 +12,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { onMounted } from 'vue' import { onMounted, watch } from 'vue'
import { eventHandlerHook } from '@/hooks/eventHandler.hook'; import { eventHandlerHook } from '@/hooks/eventHandler.hook';
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'; import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore';
@ -26,18 +26,21 @@ const props = defineProps({
}) })
const changeButton = (type) => { const changeButton = (type) => {
props.chartConfig.option.selectButton = type props.chartConfig.option.selectButton = type
eventHandlerHook( eventHandlerHook(
chartEditStore.getComponentList, chartEditStore.getComponentList,
props.chartConfig.events.interactConfigEvents[type], props.chartConfig.events.interactConfigEvents[type],
'click', 'click',
type, type,
); );
} }
watch(() => props.chartConfig.status.hide, (newVal) => {
if(!newVal && props.chartConfig.option.selectButton){
changeButton(props.chartConfig.option.selectButton)
}
})
const { list, selectButton } = props.chartConfig.option const { list, selectButton } = props.chartConfig.option
</script> </script>