Parcourir la source

fix(media): the name of uncommitted data cannot be modified

Casper Dai il y a 3 ans
Parent
commit
f8cb9609c5
1 fichiers modifiés avec 13 ajouts et 1 suppressions
  1. 13 1
      src/views/platform/media/index.vue

+ 13 - 1
src/views/platform/media/index.vue

@@ -129,7 +129,19 @@ export default {
         transform: this.transform,
         cols: [
           this.isAudio ? null : { prop: 'file', label: '缩略图', type: 'asset', on: this.onViewAsset },
-          { prop: 'name', label: '文件名' },
+          { prop: 'name', label: '文件名', render: this.active === `${State.READY}` ? (data, h) => {
+            return h('edit-input', {
+              model: {
+                value: data.name,
+                callback (val) {
+                  data.name = typeof val === 'string' ? val.trim() : val
+                }
+              },
+              on: {
+                edit: () => this.onEdit(data)
+              }
+            })
+          } : null },
           this.isImage ? null : { prop: 'duration', label: '时长' },
           { prop: 'size', label: '文件大小' },
           { prop: 'createTime', label: '上传时间' },