Commit 6380a42d authored by chenqikuai's avatar chenqikuai

fix: 修复首页删除文件夹后,页面没有刷新的bug

parent 954c5f02
...@@ -26,15 +26,16 @@ export default class Index extends Vue { ...@@ -26,15 +26,16 @@ export default class Index extends Vue {
const { folder_name } = folder; const { folder_name } = folder;
return true; return true;
} }
private delFolder(folder: any) { private delFolder(folder: any, refresh: () => void) {
const { folder_id} = folder; const { folder_id} = folder;
return new Promise((resolve: any) => { return new Promise((resolve: any) => {
this.$dialog.confirm({ this.$dialog.confirm({
message: '您确定要删除该文件夹吗?', message: '您确定要删除该文件夹吗?',
beforeClose: (action, done) => { beforeClose: (action, done) => {
if ( action === 'confirm' ) { if ( action === 'confirm' ) {
this.$api.template.delete(folder_id).then((res: any) => { this.$api.template.delete(folder_id).then(async (res: any) => {
resolve(); resolve();
await refresh();
this.$toast.success('删除成功'); this.$toast.success('删除成功');
done(); done();
}).catch((err: any) => { }).catch((err: any) => {
......
...@@ -193,15 +193,20 @@ export default class IndexSy extends Mixins(IndexMixin) { ...@@ -193,15 +193,20 @@ export default class IndexSy extends Mixins(IndexMixin) {
return [rename, del]; return [rename, del];
} }
private async callbackAction(cb: any) { private async callbackAction(cb: any) {
this.isShowRename = await cb.call(this, this.currentFolder); this.isShowRename = await cb.call(this, this.currentFolder, this.refreshPage);
} }
private async onConfirm() {
const params = this.currentFolder; private async refreshPage(){
await this.$api.template.updateFolder(params);
this.setPage(1); this.setPage(1);
await this.getUserFolders({ await this.getUserFolders({
page: this.page page: this.page
}); });
}
private async onConfirm() {
const params = this.currentFolder;
await this.$api.template.updateFolder(params);
await this.refreshPage();
Toast.success({ Toast.success({
message: "重命名成功" message: "重命名成功"
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment