Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
修改 多文件上传后删除中间某个文件后再上传序号错误问题
  • Loading branch information
jjjachyty committed Jun 14, 2018
commit 6bee543aeb08fd8f91e8f70c2d9d49449a910472
11 changes: 7 additions & 4 deletions src/components/md-toolbar-left.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
<input type="file" accept="image/gif,image/jpeg,image/jpg,image/png,image/svg" @change="$imgAdd($event)" multiple="multiple"/>{{d_words.tl_upload}}
</div>

<div class="dropdown-item dropdown-images" :title="item[0].name" v-if="index >= 0" v-for="(item, index) in img_file" @click.stop="$imgFileListClick(index)">
<div class="dropdown-item dropdown-images" :title="item[0].name" v-if="item" v-for="(item, index) in img_file" @click.stop="$imgFileListClick(index)">
<span>{{item[0].name}}</span>
<button slot="right" type="button" @click.stop="$imgDel(index)"
class="op-icon fa fa-mavon-trash-o" aria-hidden="true"
Expand Down Expand Up @@ -187,8 +187,9 @@
// this.img_file[0][1] = $file;
// this.img_file.unshift([(this.num + 1), null]);
// this.num = this.num + 1;
this.img_file.push([$file,,this.img_file.length])
this.$emit('imgAdd', this.img_file.length-1, $file);
this.img_file.push([$file,this.num])
this.$emit('imgAdd', this.num, $file);
this.num = this.num + 1;
this.s_img_dropdown_open = false;
},
$imgFilesAdd($files) {
Expand All @@ -207,7 +208,9 @@
},
$imgDel(pos) {
this.$emit('imgDel', this.img_file[pos]);
this.img_file.splice(pos, 1);
// this.img_file.splice(pos, 1);
delete this.img_file[pos];

this.s_img_dropdown_open = false;
},
isEqualName(filename, pos) {
Expand Down
4 changes: 2 additions & 2 deletions src/mavon-editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -378,11 +378,11 @@
// TODO 跳转到图片位置
},
$imgDel(file) {
this.markdownIt.image_del(file[1]);
this.markdownIt.image_del(file[0]);
// 删除所有markdown中的图片
let fileReg = file[1]
let reg = new RegExp(`\\!\\[${file[0]._name}\\]\\(${fileReg}\\)`, "g")
console.log("reg----",reg)

this.d_value = this.d_value.replace(reg, '');
this.iRender();
this.$emit('imgDel', file);
Expand Down