From b0cff71b240f40876c87167ee5ee0a4a257c6261 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Fri, 5 Mar 2021 01:27:32 +0800 Subject: [PATCH] fix incorrect style when switch pages but some error occurs --- src/mobile-main.js | 18 ++++++++++++++++++ src/views/mobile/accounts/Edit.vue | 15 +++++++++------ src/views/mobile/accounts/List.vue | 12 +++++++----- src/views/mobile/categories/All.vue | 17 ++++++++++------- src/views/mobile/categories/Edit.vue | 19 +++++++++++-------- src/views/mobile/categories/List.vue | 14 ++++++++------ src/views/mobile/categories/Preset.vue | 9 ++++++--- .../statistics/AccountFilterSettings.vue | 15 +++++++++------ .../statistics/CategoryFilterSettings.vue | 15 +++++++++------ src/views/mobile/statistics/Transaction.vue | 12 +++++++----- src/views/mobile/tags/List.vue | 15 +++++++++------ src/views/mobile/transactions/Edit.vue | 15 ++++++++++----- src/views/mobile/transactions/List.vue | 14 +++++++++----- src/views/mobile/users/SessionList.vue | 17 ++++++++++------- src/views/mobile/users/TwoFactorAuth.vue | 15 +++++++++------ src/views/mobile/users/UserProfile.vue | 15 +++++++++------ 16 files changed, 150 insertions(+), 87 deletions(-) diff --git a/src/mobile-main.js b/src/mobile-main.js index aa134075..0db26ec9 100644 --- a/src/mobile-main.js +++ b/src/mobile-main.js @@ -299,6 +299,24 @@ Vue.prototype.$showLoading = function (delayConditionFunc, delayMills) { Vue.prototype.$hideLoading = function () { return this.$f7.preloader.hide(); }; +Vue.prototype.$routeBackOnError = function (errorPropertyName) { + const self = this; + const router = self.$f7router; + + const unwatch = self.$watch(errorPropertyName, () => { + if (self[errorPropertyName]) { + setTimeout(() => { + if (unwatch) { + unwatch(); + } + + router.back(); + }, 200); + } + }, { + immediate: true + }); +}; Vue.prototype.$user = userstate; diff --git a/src/views/mobile/accounts/Edit.vue b/src/views/mobile/accounts/Edit.vue index 5adc0b34..2666a967 100644 --- a/src/views/mobile/accounts/Edit.vue +++ b/src/views/mobile/accounts/Edit.vue @@ -1,5 +1,5 @@