code: optimize panel

This commit is contained in:
ShawnPhang 2023-09-01 16:20:08 +08:00
parent 3615a040f0
commit e585781c34

View File

@ -38,21 +38,15 @@ export default {
const route = useRoute() const route = useRoute()
const state = reactive({ const state = reactive({
widgetClassifyList: widgetClassifyListData, widgetClassifyList: widgetClassifyListData,
activeWidgetClassify: -1, activeWidgetClassify: 0,
active: true, active: true,
}) })
const clickClassify = (index: number) => { const clickClassify = (index: number) => {
state.activeWidgetClassify = index state.activeWidgetClassify = index
state.active = true state.active = true
} }
const getStyle = (index: number) => {
return {
display: state.activeWidgetClassify === index ? '' : 'none',
}
}
onMounted(async () => { onMounted(async () => {
state.activeWidgetClassify = 0
await nextTick() await nextTick()
const { koutu } = route.query const { koutu } = route.query
koutu && (state.activeWidgetClassify = 5) koutu && (state.activeWidgetClassify = 5)
@ -82,7 +76,6 @@ export default {
return { return {
clickClassify, clickClassify,
getStyle,
...toRefs(state), ...toRefs(state),
} }
}, },