diff --git a/mindinsight/ui/src/components/header.vue b/mindinsight/ui/src/components/header.vue index 3e1b1312..c85ba0b4 100644 --- a/mindinsight/ui/src/components/header.vue +++ b/mindinsight/ui/src/components/header.vue @@ -108,6 +108,7 @@ export default { timeReloadValue: this.$store.state.timeReloadValue, newReloadValue: this.$store.state.timeReloadValue, showDebugger: window.enableDebugger, + path: null, }; }, computed: { @@ -135,9 +136,26 @@ export default { return isChinese; }, }, - watch: {}, + watch: { + 'path'(newValue, oldValue) { + if (oldValue) { + this.clearPageIndex(); + } + }, + }, mounted() {}, methods: { + /** + * The logic of clear page index memory + */ + clearPageIndex() { + if (sessionStorage.getItem('XAIPageIndex')) { + sessionStorage.removeItem('XAIPageIndex'); + } + if (sessionStorage.getItem('summaryPageIndex')) { + sessionStorage.removeItem('summaryPageIndex'); + } + }, // click reload setReload() { this.$store.commit('clearToken'); @@ -191,17 +209,29 @@ export default { // get active menu item getActive() { const str = this.$route.path.split('/'); + let path; if (str.length > 1) { if (!str[1]) { return; } if (str[1] === 'debugger') { - return this.$route.path; + path = '/debugger'; } else if (str[1] === 'explain') { - return `/${str[1]}`; + path = '/explain'; + } else { + path = '/summary-manage'; } + } else { + path = '/summary-manage'; + } + if (this.path) { + if (this.path !== path) { + this.path = path; + } + } else { + this.path = path; } - return '/summary-manage'; + return path; }, changeLanguage(lan) { localStorage.setItem('milang', lan); diff --git a/mindinsight/ui/src/views/explain/summary-list.vue b/mindinsight/ui/src/views/explain/summary-list.vue index 33212d6a..f91114bf 100644 --- a/mindinsight/ui/src/views/explain/summary-list.vue +++ b/mindinsight/ui/src/views/explain/summary-list.vue @@ -96,7 +96,7 @@ limitations under the License.