소스 검색

fix: 修复 useStationScope 回调前置引用引发的页面 TDZ 崩溃

useStationScope 调用时读取 loadData 常量绑定,若声明在其后则 setup 阶段抛 ReferenceError(压缩后表现为 Cannot access 'u' before initialization),涉及停车券发放记录、月/日统计、设备、站点账户、用户、投资人、结算、提现、分账共 10 个页面,统一改为回调懒引用规避声明顺序问题。
skyline 3 일 전
부모
커밋
335e6662df

+ 2 - 2
admin-web/src/views/admin/account/index.vue

@@ -326,8 +326,8 @@ const state = reactive({
 onBeforeMount(() => {
 })
 
-//站点筛选与全局当前站点联动
-useStationScope(state.formQuery, loadData);
+//站点筛选与全局当前站点联动(回调懒引用,规避 loadData 声明顺序的 TDZ 错误)
+useStationScope(state.formQuery, (refresh?: boolean) => loadData(refresh));
 
 onMounted(() => {
   loadData();

+ 2 - 2
admin-web/src/views/admin/finance/settlement.vue

@@ -196,8 +196,8 @@ const state = reactive({
   ],
 })
 
-//站点筛选与全局当前站点联动
-useStationScope(state.formQuery, loadData);
+//站点筛选与全局当前站点联动(回调懒引用,规避 loadData 声明顺序的 TDZ 错误)
+useStationScope(state.formQuery, (refresh?: boolean) => loadData(refresh));
 
 onMounted(() => {
   loadData();

+ 2 - 2
admin-web/src/views/admin/finance/splitRecord.vue

@@ -218,8 +218,8 @@ const state = reactive({
 
 //生命周期钩子
 //生命周期钩子
-//站点筛选默认全局当前站点;本页面常由站点账户跳转携带指定站点,不跟随全局切换
-useStationScope(state.formQuery, loadData, {follow: false});
+//站点筛选默认全局当前站点;本页面常由站点账户跳转携带指定站点,不跟随全局切换(回调懒引用,规避 TDZ 错误)
+useStationScope(state.formQuery, (refresh?: boolean) => loadData(refresh), {follow: false});
 
 onBeforeMount(() => {
 

+ 2 - 2
admin-web/src/views/admin/finance/withdraw.vue

@@ -191,8 +191,8 @@ onBeforeMount(() => {
 
 })
 
-//站点筛选与全局当前站点联动
-useStationScope(state.formQuery, loadData);
+//站点筛选与全局当前站点联动(回调懒引用,规避 loadData 声明顺序的 TDZ 错误)
+useStationScope(state.formQuery, (refresh?: boolean) => loadData(refresh));
 
 onMounted(() => {
   loadData();

+ 2 - 2
admin-web/src/views/admin/investor/index.vue

@@ -202,8 +202,8 @@ const state = reactive({
 onBeforeMount(() => {
 })
 
-//站点筛选与全局当前站点联动
-useStationScope(state.formQuery, loadData);
+//站点筛选与全局当前站点联动(回调懒引用,规避 loadData 声明顺序的 TDZ 错误)
+useStationScope(state.formQuery, (refresh?: boolean) => loadData(refresh));
 
 onMounted(() => {
   loadData();

+ 2 - 2
admin-web/src/views/admin/parking-coupon-record/index.vue

@@ -130,8 +130,8 @@ const state = reactive({
   ],
 })
 
-//站点筛选与全局当前站点联动
-useStationScope(state.formQuery, loadData);
+//站点筛选与全局当前站点联动(回调懒引用,规避 loadData 声明顺序的 TDZ 错误)
+useStationScope(state.formQuery, (refresh?: boolean) => loadData(refresh));
 
 onMounted(() => {
   loadData();

+ 2 - 2
admin-web/src/views/admin/station/account/index.vue

@@ -177,8 +177,8 @@ const state = reactive({
 //         }
 // );
 
-//站点筛选与全局当前站点联动
-useStationScope(state.formQuery, loadData);
+//站点筛选与全局当前站点联动(回调懒引用,规避 loadData 声明顺序的 TDZ 错误)
+useStationScope(state.formQuery, (refresh?: boolean) => loadData(refresh));
 
 //生命周期钩子
 onBeforeMount(() => {

+ 2 - 2
admin-web/src/views/admin/station/device/index.vue

@@ -234,8 +234,8 @@ const state = reactive({
 //         }
 // );
 
-//站点筛选与全局当前站点联动
-useStationScope(state.formQuery, loadData);
+//站点筛选与全局当前站点联动(回调懒引用,规避 loadData 声明顺序的 TDZ 错误)
+useStationScope(state.formQuery, (refresh?: boolean) => loadData(refresh));
 
 //生命周期钩子
 onBeforeMount(() => {

+ 2 - 2
admin-web/src/views/admin/statistics/daily-stat.vue

@@ -158,8 +158,8 @@ const state = reactive({
   ],
 })
 
-//站点筛选与全局当前站点联动
-useStationScope(state.formQuery, loadData);
+//站点筛选与全局当前站点联动(回调懒引用,规避 loadData 声明顺序的 TDZ 错误)
+useStationScope(state.formQuery, (refresh?: boolean) => loadData(refresh));
 
 onMounted(() => {
   // 同步日期默认昨天

+ 2 - 2
admin-web/src/views/admin/statistics/month-stat.vue

@@ -144,8 +144,8 @@ const state = reactive({
   ],
 })
 
-//站点筛选与全局当前站点联动
-useStationScope(state.formQuery, loadData);
+//站点筛选与全局当前站点联动(回调懒引用,规避 loadData 声明顺序的 TDZ 错误)
+useStationScope(state.formQuery, (refresh?: boolean) => loadData(refresh));
 
 onMounted(() => {
   // 同步月份默认上月