mirror of
https://github.com/purocean/yn.git
synced 2026-10-13 07:38:54 +08:00
修复选择文件不展开文件树
This commit is contained in:
@@ -74,10 +74,10 @@ export default {
|
||||
this.updateSelected(this.list[index])
|
||||
},
|
||||
chooseItem (item = null) {
|
||||
if (item) {
|
||||
this.$emit('choose-item', item)
|
||||
} else if (this.selected) {
|
||||
this.$emit('choose-item', this.selected)
|
||||
const file = item || this.selected
|
||||
if (file) {
|
||||
this.$emit('choose-file', file)
|
||||
this.$bus.emit('choose-file', file)
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
@delete="onDelete" />
|
||||
<transition name="fade">
|
||||
<div v-if="showFilter" class="filter-wrapper" @click="showFilter = false">
|
||||
<XFilter @choose-item="f => { file = f; showFilter = false }" :files="files" />
|
||||
<XFilter @choose-file="f => { showFilter = false }" :files="files" />
|
||||
</div>
|
||||
</transition>
|
||||
</aside>
|
||||
|
||||
@@ -43,15 +43,20 @@ export default {
|
||||
},
|
||||
mounted () {
|
||||
this.$bus.on('editor-ready', () => {
|
||||
const filePath = this.getSelectedFilePath()
|
||||
this.chooseFile(this.getSelectedFilePath())
|
||||
})
|
||||
this.$bus.on('choose-file', file => {
|
||||
this.chooseFile(file.path)
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
chooseFile (filePath) {
|
||||
if (this.item.type === 'dir' && filePath.startsWith(this.item.path)) {
|
||||
this.$refs.dir.open = true
|
||||
} else if (filePath === this.item.path) {
|
||||
this.select(this.item)
|
||||
}
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
},
|
||||
select (f) {
|
||||
if (f.name.endsWith('.md')) {
|
||||
this.$nextTick(() => {
|
||||
|
||||
Reference in New Issue
Block a user