|
|
@@ -166,7 +166,7 @@ export default {
|
|
|
showPreview: false,
|
|
|
showRename: false,
|
|
|
showList: false,
|
|
|
- popupItem: "",
|
|
|
+ popupItem: null,
|
|
|
tabHeader: data,
|
|
|
selectedArr: [],
|
|
|
searchKey: "",
|
|
|
@@ -192,21 +192,27 @@ export default {
|
|
|
const viewer = this.$el.querySelector("#" + id).$viewer;
|
|
|
viewer.show();
|
|
|
},
|
|
|
- handleRename(data) {
|
|
|
+ handleRename(newName) {
|
|
|
editMaterial(
|
|
|
{
|
|
|
id: this.popupItem.id,
|
|
|
- name: data,
|
|
|
+ name: newName,
|
|
|
},
|
|
|
() => {
|
|
|
this.$msg.success("修改成功");
|
|
|
+ const index = this.list.findIndex((eachItem) => {
|
|
|
+ return eachItem.id === this.popupItem.id
|
|
|
+ })
|
|
|
+ if (index >= 0) {
|
|
|
+ this.list[index].name = newName
|
|
|
+ } else {
|
|
|
+ console.error('在素材列表里没找到要重命名的那一项!');
|
|
|
+ }
|
|
|
this.showRename = false;
|
|
|
- this.popupItem = "";
|
|
|
- this.getMaterialList();
|
|
|
+ this.popupItem = null;
|
|
|
}
|
|
|
);
|
|
|
},
|
|
|
-
|
|
|
delUploadItem(index) {
|
|
|
~index && this.uploadList.splice(index, 1);
|
|
|
},
|