pageAdmin add setActivePageComputedByRoute function
This commit is contained in:
@@ -42,11 +42,17 @@ export default {
|
||||
Loading
|
||||
},
|
||||
computed: {
|
||||
...mapState(PageAdminStore, ['shouldKeepPreviousPage']),
|
||||
...mapState(PageAdminStore, [
|
||||
'shouldKeepPreviousPage',
|
||||
'activePageComputedByRoute'
|
||||
]),
|
||||
},
|
||||
methods: {
|
||||
...mapActions(PageAdminStore, ['copyPendingPageToActivePage', 'setPrevioiusPage',
|
||||
...mapActions(PageAdminStore, [
|
||||
'copyPendingPageToActivePage',
|
||||
'setPrevioiusPage',
|
||||
'clearShouldKeepPreviousPageBoolean',
|
||||
'setActivePageComputedByRoute',
|
||||
],),
|
||||
},
|
||||
created() {
|
||||
@@ -54,10 +60,11 @@ export default {
|
||||
const token = document.cookie.replace(/(?:(?:^|.*;\s*)luciaToken\s*\=\s*([^;]*).*$)|^.*$/, "$1");
|
||||
this.$http.defaults.headers.common['Authorization'] = `Bearer ${token}`;
|
||||
},
|
||||
// Swal modal handling is called before beforeRouteUpdate
|
||||
// Rember, Swal modal handling is called before beforeRouteUpdate
|
||||
beforeRouteUpdate(to, from, next) {
|
||||
// console.log("beforeRouteUpdate", from.name, "to:", to.name);
|
||||
this.setPrevioiusPage(from.name);
|
||||
this.setActivePageComputedByRoute(to.matched);
|
||||
|
||||
// 離開 Map 頁時判斷是否有無資料和需要存檔
|
||||
if ((from.name === 'Map' || from.name === 'CheckMap') && this.tempFilterId) {
|
||||
@@ -76,6 +83,9 @@ export default {
|
||||
// In this else block:
|
||||
// for those pages who don't need popup modals, we handle page administration right now.
|
||||
// By calling the following code, we decide the next visiting page.
|
||||
// 在這個 else 區塊中:
|
||||
// 對於那些不需要彈窗的頁面,我們現在就處理頁面管理。
|
||||
// 透過呼叫以下代碼,我們決定出下一個將要走訪的頁面。
|
||||
this.copyPendingPageToActivePage();
|
||||
next();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user