Fixed: #175 || gallery page keep-alive

This commit is contained in:
Molunerfinn
2019-01-24 11:29:48 +08:00
parent e8f2185bbb
commit 649e9f0695
5 changed files with 28 additions and 14 deletions

View File

@@ -64,7 +64,12 @@
class="main-wrapper"
:class="{ 'darwin': os === 'darwin' }">
<transition name="picgo-fade" mode="out-in">
<router-view :key="$route.params ? $route.params.type : $route.path"></router-view>
<keep-alive>
<router-view v-if="$route.meta.keepAlive"></router-view>
</keep-alive>
</transition>
<transition name="picgo-fade" mode="out-in">
<router-view :key="$route.path" v-if="!$route.meta.keepAlive"></router-view>
</transition>
</el-col>
</el-row>
@@ -296,7 +301,7 @@ $darwinBg = transparentify(#172426, #000, 0.7)
opacity 0
&-enter-active,
&-leave-active
transition opacity 100ms linear
transition all 100ms linear
.view-title
color #eee
font-size 20px

View File

@@ -139,8 +139,14 @@ export default {
picBed: []
}
},
beforeRouteEnter (to, from, next) {
next(vm => {
vm.getGallery()
vm.getPasteStyle()
vm.getPicBeds()
})
},
created () {
this.getGallery()
this.$electron.ipcRenderer.on('updateGallery', (event) => {
this.$nextTick(() => {
this.filterList = this.getGallery()
@@ -148,8 +154,6 @@ export default {
})
this.$electron.ipcRenderer.send('getPicBeds')
this.$electron.ipcRenderer.on('getPicBeds', this.getPicBeds)
this.getPasteStyle()
this.getPicBeds()
},
computed: {
filterList: {
@@ -368,6 +372,8 @@ export default {
transition all .2s ease-in-out
&.active
transform: rotate(180deg)
#gallery-view
height 100%
.item-base
background #2E2E2E
text-align center

View File

@@ -78,7 +78,10 @@ export default new Router({
{
path: 'gallery',
component: require('@/pages/Gallery').default,
name: 'gallery'
name: 'gallery',
meta: {
keepAlive: true
}
},
{
path: 'setting',