@@ -50,19 +50,24 @@ export default {
5050 if (this .resource .type ) {
5151 this .$ipcRenderer .on (IPCRendererResponse .ON_EXTENSION_CONTENT_UPDATE , this .onContentViewUpdate )
5252 this .$ipcRenderer .send (IPCNormalMessage .RETRIEVE_CONTENT_VIEW , this .resource .type )
53- bus .emit (bus .EVENT_UPDATE_NAV_DESCRIBTION , {name: ' 图片显示' , cmd: ' display' })
54- // for (let idx = 0; idx < this.candidates.length; ++idx) {
55- // if (this.candidates[idx].id === this.image.id) {
56- // this.index = idx
57- // this.$nextTick(() => {
58- // bus.emit(bus.EVENT_DISPLAY_FILE_NAME, this.candidates[idx].filename)
59- // })
60- // break
61- // }
62- // }
53+ bus .emit (bus .EVENT_UPDATE_NAV_DESCRIBTION , {name: ' 资源' , cmd: ' display' })
54+ for (let idx = 0 ; idx < this .candidates .length ; ++ idx) {
55+ if (this .candidates [idx].id === this .resource .id ) {
56+ this .index = idx
57+ break
58+ }
59+ }
6360 } else {
6461 // unkonw file type
6562 }
63+ this .$nextTick (() => {
64+ bus .emit (bus .EVENT_DISPLAY_FILE_NAME , this .resource .filename || this .resource .name )
65+ })
66+ },
67+ watch: {
68+ $route : function (to , from ) {
69+ console .info (' content panel, to: ' , to, ' from:' , from .path )
70+ }
6671 },
6772 async updated () {
6873 if (this .isUpdated ) return
@@ -76,19 +81,22 @@ export default {
7681 return
7782 }
7883 const path = require (' path' )
79- events .emit (' ContentView:' + contentView, ' load' , path .normalize (this .resource . _path ))
84+ events .emit (' ContentView:' + contentView, ' load' , path .normalize (this .candidates [ this . index ]. path ))
8085 this .isUpdated = true
8186 },
8287 methods: {
8388 onClickNext () {
84- console .info (' next image' )
89+ console .info (' next image' , this . index )
8590 if (this .index > this .candidates .length ) {
8691 this .index = this .candidates .length
8792 return
8893 }
8994 this .index += 1
9095 bus .emit (bus .EVENT_DISPLAY_FILE_NAME , this .candidates [this .index ].filename )
91- bus .emit (bus .EVENT_SELECT_IMAGE , this .candidates [this .index ].id )
96+ const id = this .candidates [this .index ].id
97+ this .$ipcRenderer .send (IPCNormalMessage .GET_SELECT_CONTENT_ITEM_INFO , {id: [id]})
98+ const type = this .candidates [this .index ].type
99+ this .$ipcRenderer .send (IPCNormalMessage .RETRIEVE_CONTENT_VIEW , type)
92100 },
93101 onClickPrev () {
94102 console .info (' prev image' )
@@ -98,7 +106,10 @@ export default {
98106 }
99107 this .index -= 1
100108 bus .emit (bus .EVENT_DISPLAY_FILE_NAME , this .candidates [this .index ].filename )
101- bus .emit (bus .EVENT_SELECT_IMAGE , this .candidates [this .index ].id )
109+ const id = this .candidates [this .index ].id
110+ this .$ipcRenderer .send (IPCNormalMessage .GET_SELECT_CONTENT_ITEM_INFO , {id: [id]})
111+ const type = this .candidates [this .index ].type
112+ this .$ipcRenderer .send (IPCNormalMessage .RETRIEVE_CONTENT_VIEW , type)
102113 },
103114 onContentViewUpdate (session , value ) {
104115 console .debug (' onContentViewUpdate:' , value)
0 commit comments