doway-coms 2.10.22 → 2.10.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "doway-coms",
3
- "version": "2.10.22",
3
+ "version": "2.10.24",
4
4
  "description": "doway组件库",
5
5
  "author": "dowaysoft",
6
6
  "main": "packages/index.js",
@@ -119,7 +119,7 @@
119
119
 
120
120
  </div>
121
121
  </a-upload>
122
- <span @click="pasteFileClick">黏贴</span>
122
+ <div ref="pasteFileView">黏贴</div>
123
123
  <div v-if="edit !== true && showEmptyText && internalRows.length === 0">
124
124
  没有附件信息哦,请编辑添加附件信息
125
125
  </div>
@@ -290,6 +290,12 @@ export default {
290
290
  this.uploadData.resId = this.resId;
291
291
  this.uploadData.picAction = this.internalServiceUrl + "/UploadAttach";
292
292
  this.getAttachInfo(this.rows);
293
+
294
+ this.$refs.pasteFileView.addEventListener('paste', async (e) => {
295
+ e.preventDefault();
296
+ await this.pasteFileClick(e)
297
+ })
298
+
293
299
  },
294
300
  methods: {
295
301
  getCurrentToken() {
@@ -458,26 +464,26 @@ export default {
458
464
  /**
459
465
  * 黏贴附件
460
466
  */
461
- async pasteFileClick(){
462
- const items = await navigator.clipboard.read();
467
+ async pasteFileClick(e){
468
+ console.debug('e',e)
469
+ const items = e.clipboardData.files;
463
470
  console.debug('items',items)
464
471
  for (const item of items) {
465
- for (const type of item.types) {
466
- if (type.startsWith('image/') || type.startsWith('application/')) {
467
- const blob = await item.getType(type);
468
- //'复制文件'+this.$store.getters.newId() +'.png'
469
- this.pasteFile = new File([blob],`复制文件${this.$store.getters.newId()}.${type.split('/')[1]}` , { type });
470
- this.uploadPasteFile()
471
- return
472
- // console.debug('file',file)
473
- // this.uploadFileList = [file];
474
- // const reader = new FileReader();
475
- // reader.onload = (e) => {
476
- // console.debug(e)
477
- // // this.imageSrc = e.target.result;
478
- // };
479
- // reader.readAsDataURL(blob);
480
- }
472
+ if (item.type.startsWith('image/') || item.type.startsWith('application/')) {
473
+ // this.pasteFile = URL.createObjectURL(item)
474
+ //'复制文件'+this.$store.getters.newId() +'.png'
475
+ let type = item.type
476
+ this.pasteFile = new File([item],`复制文件${this.$store.getters.newId()}.${type.split('/')[1]}` , { type });
477
+ this.uploadPasteFile()
478
+ return
479
+ // console.debug('file',file)
480
+ // this.uploadFileList = [file];
481
+ // const reader = new FileReader();
482
+ // reader.onload = (e) => {
483
+ // console.debug(e)
484
+ // // this.imageSrc = e.target.result;
485
+ // };
486
+ // reader.readAsDataURL(blob);
481
487
  }
482
488
  }
483
489
  },