From d4b3fd57271ab48134c1f48f1c44094bb0538f0e Mon Sep 17 00:00:00 2001 From: zhaoxiao Date: Mon, 6 Mar 2023 09:10:33 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90fix=20ESLint=E3=80=91src/components/je?= =?UTF-8?q?ro/JImageUpload?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jero-web/src/components/jero/JImageUpload.vue | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/jero-web/src/components/jero/JImageUpload.vue b/jero-web/src/components/jero/JImageUpload.vue index 514a4443..42f56c5d 100644 --- a/jero-web/src/components/jero/JImageUpload.vue +++ b/jero-web/src/components/jero/JImageUpload.vue @@ -33,7 +33,7 @@ import { getFileAccessHttpUrl } from '@/api/manage' const Base64 = require('js-base64').Base64 const uidGenerator = () => { - return '-' + parseInt(Math.random() * 10000 + 1, 10) + return '-' + parseInt(Math.random() * 10000 + 1 + '', 10) } export default { name: 'JImageUpload', @@ -84,7 +84,6 @@ export default { computed: { // 透传给下级组件的事件,需要排除本组件使用的change事件 childListeners () { - const vm = this const result = Object.assign({}, this.$listeners ) @@ -94,13 +93,13 @@ export default { }, watch: { value: { - handler (val, oldValue) { + handler (val) { if (val instanceof Array) { this.initFileList(val.join(',')) } else { this.initFileList(val) } - if (!val || val.length == 0) { + if (!val || val.length === 0) { this.picUrl = false } }, @@ -114,14 +113,14 @@ export default { }, methods: { initFileList (paths) { - if (!paths || paths.length == 0) { + if (!paths || paths.length === 0) { this.fileList = [] return } this.picUrl = true const fileList = [] const arr = paths.split(',') - for (var a = 0; a < arr.length; a++) { + for (let a = 0; a < arr.length; a++) { const url = getFileAccessHttpUrl(arr[a]) fileList.push({ uid: uidGenerator(), @@ -138,7 +137,7 @@ export default { this.fileList = fileList }, beforeUpload: function (file) { - var fileType = file.type + const fileType = file.type if (fileType.indexOf('image') < 0) { this.$message.warning('请上传图片') return false @@ -176,7 +175,7 @@ export default { // 预览 handlePreview (file) { if (file && file.url) { - var fileFullUrl = `${window._CONFIG.domianWebSocketURL}/${file.url}` + const fileFullUrl = `${window._CONFIG.domianWebSocketURL}/${file.url}` const url = `${window._CONFIG.onlinePreviewDomainURL}?url=${encodeURIComponent(Base64.encode(fileFullUrl))}` window.open(url) } @@ -190,7 +189,7 @@ export default { handlePathChange () { const uploadFiles = this.fileList let path = '' - if (!uploadFiles || uploadFiles.length == 0) { + if (!uploadFiles || uploadFiles.length === 0) { path = '' } const arr = []