Przeglądaj źródła

修改demand删除图片错位问题

ajun 5 lat temu
rodzic
commit
63fa0f6bae
1 zmienionych plików z 6 dodań i 4 usunięć
  1. 6 4
      resources/views/demand/search/index.blade.php

+ 6 - 4
resources/views/demand/search/index.blade.php

@@ -49,6 +49,7 @@
                 if (this.imgs && this.imgs.length > 0) {
                     window.addEventListener('scroll', this.lazy)
                 }
+                console.log(this.imgs);
                 $('#list').removeClass('d-none');
                 let data = [
                     [
@@ -104,14 +105,15 @@
                     if (!confirm('确定要删除当前需求吗?')) {
                         return;
                     }
-
                     let url = '{{url('apiLocal/demand/destroy?id=')}}' + demand['id'];
 
-                    window.tempTip.setDuration(3000);
                     window.axios.delete(url).then(res => {
                         if (res.data.success) {
                             window.tempTip.showSuccess('删除成功!');
-                            this.$delete(this.demands, index);
+                            this.$delete(this.demands,index);
+                            this.imgs = Array.from(document.getElementById('list').querySelectorAll('img'));
+                            this.lazy();
+                            this.$forceUpdate();
                             return;
                         }
                         window.tempTip.show(res.data.data);
@@ -178,7 +180,7 @@
                             this.$set(this.demands, this.selectIndex, res.data.data);
                             $('#uploadFile').modal('hide');
                             setTimeout(function(){
-                                 that.imgs.push(document.getElementById('img_'+res.data.data['id']));
+                                that.imgs.push(document.getElementById('img_'+res.data.data['id']));
                                 that.lazy();
                             },1);
                             window.tempTip.showSuccess('文件上传成功');