File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
src/components/FilterPanel Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,13 @@ const { controlSet } = defineProps({
1919})
2020
2121const appStore = useAppStore ()
22- const controlValue = ref (false )
22+
23+ const getStoreValue = () => {
24+ const parentKey = appStore .currentPageName
25+ return appStore[parentKey]? .[controlSet .storeKey ]
26+ }
27+
28+ const controlValue = ref (getStoreValue () ?? controlSet .defaultValue ?? false )
2329
2430const resetInput = inject (' resetInput' )
2531
@@ -28,6 +34,12 @@ watch(resetInput, () => {
2834 appStore .updateSwitch (controlSet .storeKey , controlSet .defaultValue )
2935})
3036
37+ watch (getStoreValue, (newValue ) => {
38+ if (newValue !== undefined && newValue !== controlValue .value ) {
39+ controlValue .value = newValue
40+ }
41+ })
42+
3143onMounted (() => {
3244 populateControlData ()
3345})
You can’t perform that action at this time.
0 commit comments