Discover: Save button done.
This commit is contained in:
@@ -18,6 +18,7 @@ import AllMapDataStore from '@/stores/allMapData.js';
|
||||
import Header from "@/components/Header.vue";
|
||||
import Navbar from "@/components/Navbar.vue";
|
||||
import Loading from '@/components/Loading.vue';
|
||||
import { saveFilter, leaveFilter } from '@/module/alertModal.js';
|
||||
|
||||
export default {
|
||||
name: 'MainContainer',
|
||||
@@ -26,9 +27,9 @@ export default {
|
||||
const loadingStore = LoadingStore();
|
||||
const allMapDataStore = AllMapDataStore();
|
||||
const { checkLogin } = loginStore;
|
||||
const { tempFilterId, temporaryData, postRuleData } = storeToRefs(allMapDataStore);
|
||||
const { tempFilterId, createFilterId, temporaryData, postRuleData } = storeToRefs(allMapDataStore);
|
||||
|
||||
return { checkLogin, loadingStore, temporaryData, tempFilterId, postRuleData };
|
||||
return { checkLogin, loadingStore, temporaryData, tempFilterId, createFilterId, postRuleData, allMapDataStore };
|
||||
},
|
||||
watch: {
|
||||
$route: function(to, from) {
|
||||
@@ -37,27 +38,14 @@ export default {
|
||||
this.temporaryData = []
|
||||
this.postRuleData = []
|
||||
}
|
||||
// console.log(to, from);
|
||||
// if(to.name === 'Discover'){
|
||||
// this.$swal({
|
||||
// title: '請問是否要離開頁面?',
|
||||
// showCancelButton: true,
|
||||
// confirmButtonText: '是',
|
||||
// cancelButtonText: '否',
|
||||
// }).then((result) => {
|
||||
// if (result.isConfirmed) {
|
||||
// window.history.back() // 或 window.close()
|
||||
// } else {
|
||||
// console.log('no')
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
}
|
||||
},
|
||||
components: {
|
||||
Header,
|
||||
Navbar,
|
||||
Loading,
|
||||
saveFilter,
|
||||
leaveFilter
|
||||
},
|
||||
created() {
|
||||
/**
|
||||
@@ -71,26 +59,10 @@ export default {
|
||||
this.checkLogin();
|
||||
},
|
||||
beforeRouteUpdate(to, from, next) {
|
||||
if (from.name === 'Discover') {
|
||||
this.$swal({
|
||||
title: '請問是否要離開頁面?',
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: '是',
|
||||
cancelButtonText: '否',
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
console.log('yes')
|
||||
next()
|
||||
} else {
|
||||
console.log('no')
|
||||
next(false)
|
||||
}
|
||||
})
|
||||
if (from.name === 'Discover' && this.tempFilterId) {
|
||||
leaveFilter(next, this.allMapDataStore.addFilterId)
|
||||
} else {
|
||||
next()
|
||||
next();
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user