From b580ae4329a01b218e7fcf08d3a1a8ae5a72f031 Mon Sep 17 00:00:00 2001 From: haiyangcui Date: Sun, 21 Feb 2021 22:55:31 +0100 Subject: [PATCH] =?UTF-8?q?=E8=AE=B0=E5=BD=95=E6=9C=80=E8=BF=91=E6=89=93?= =?UTF-8?q?=E5=BC=80detail=E9=A1=B5=E9=9D=A2=E7=9A=84=E8=A7=86=E5=9B=BE,?= =?UTF-8?q?=E5=BD=93=E5=9B=9E=E5=88=B0=E8=AF=A5=E8=A7=86=E5=9B=BE=E6=97=B6?= =?UTF-8?q?,=E6=81=A2=E5=A4=8Ddetail=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Aside.vue | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/components/Aside.vue b/src/components/Aside.vue index cc68295..6bd54b7 100644 --- a/src/components/Aside.vue +++ b/src/components/Aside.vue @@ -53,6 +53,12 @@ import { mapMutations } from 'vuex' export default { name: 'Aside', + data () { + return { + lastViewOpenDetail: '', + savedDetail: {} + } + }, computed: { view: { get () { @@ -74,9 +80,19 @@ export default { methods: { ...mapMutations(['SET_VIEW', 'SET_DETAIL']), changeView (e) { + // 记录打开detail的view + if (this.detail.show === true) { + this.lastViewOpenDetail = this.view + this.savedDetail = this.detail + } this.view = e - this.detail = { - show: false + // 如果回到上一次打开detail的试图页面,恢复detail页面 + if (e === this.lastViewOpenDetail) { + this.detail = this.savedDetail + } else { + this.detail = { + show: false + } } } }