Sfoglia il codice sorgente

添加获取指定类型附件

xiaohaizhao 1 anno fa
parent
commit
c1855c76dd
1 ha cambiato i file con 10 aggiunte e 0 eliminazioni
  1. 10 0
      utils/tool.js

+ 10 - 0
utils/tool.js

@@ -114,6 +114,16 @@ function mount() {
             }
         })
     };
+    //得到缩略图或者压缩图  getType默认得到缩略图传true得到压缩图
+    /**
+     * 
+     * @param {string} type compressed压缩图;thumbnail缩略图,hls转码视频,cover封面
+     * @returns 
+     */
+    Vue.prototype.getSpecifiedImage = (item, type = 'thumbnail') => {
+        let v = item.subfiles.find(v => v.type == type);
+        return v ? v.url : item.url;
+    }
 }
 
 module.exports = {