This commit is contained in:
pushuo 2022-07-13 16:44:08 +08:00
parent 4009649e45
commit e333b42f4d
1 changed files with 8 additions and 7 deletions

View File

@ -24,8 +24,7 @@
{{-- :load="loadNod1e" --}} {{-- :load="loadNod1e" --}}
{{-- lazy --}} {{-- lazy --}}
:default-expanded-keys="['/']" :default-expanded-keys="['/']"
{{-- :render-after-expand="false" --}} :expand-on-click-node="false"
{{-- :expand-on-click-node="false" --}}
highlight-current highlight-current
ref="tree" ref="tree"
@node-click="handleNodeClick" @node-click="handleNodeClick"
@ -144,13 +143,13 @@
// 组件方法 // 组件方法
methods: { methods: {
handleNodeClick(e, node, data) { handleNodeClick(e, node, data) {
if (e.path == this.folderCurrent || e.children) { if (e.path == this.folderCurrent) {
return; return;
} }
this.folderCurrent = e.path this.folderCurrent = e.path
this.image_page = 1; this.image_page = 1;
this.loadData(node) this.loadData(e, node)
}, },
pageCurrentChange(e) { pageCurrentChange(e) {
@ -158,12 +157,13 @@
this.loadData() this.loadData()
}, },
loadData(node) { loadData(e, node) {
$http.get(`file_manager?base_folder=${this.folderCurrent}`, {page: this.image_page}).then((res) => { $http.get(`file_manager?base_folder=${this.folderCurrent}`, {page: this.image_page}).then((res) => {
if (node) { if (node) {
if (!e.children) {
node.expanded = !node.expanded;
}
this.$refs["tree"].updateKeyChildren(this.folderCurrent, res.folders); this.$refs["tree"].updateKeyChildren(this.folderCurrent, res.folders);
node.expanded = !node.expanded;
// node.expanded = true;
} }
this.images = res.images this.images = res.images
@ -263,6 +263,7 @@
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
inputPattern: /^.+$/, inputPattern: /^.+$/,
inputValue: data ? data.name : '',
inputErrorMessage: '不能为空' inputErrorMessage: '不能为空'
}).then(({ value }) => { }).then(({ value }) => {
if (type == 'addFolder') { if (type == 'addFolder') {