Showing
3 changed files
with
4 additions
and
25 deletions
1 | <cm-dialog v-if="!isInset" title="文件上传" width="500px" :showDialogVisible="show" @hidedialog="hidedialog" @okfunc="uploadFile" okText="上传"> | 1 | <cm-dialog v-if="!isInset" title="文件上传" width="500px" :showDialogVisible="show" @hidedialog="hidedialog" @okfunc="uploadFile" okText="上传"> |
2 | <template v-slot> | 2 | <template v-slot> |
3 | - <!-- //start lsq 文件上传更换为单文件通过multiple值判断,:on-change="handleChange",:file-list="fileListNow" 2022-03-30--> | 3 | + |
4 | <el-upload | 4 | <el-upload |
5 | :accept="accept" | 5 | :accept="accept" |
6 | ref="upload" | 6 | ref="upload" |
7 | :http-request="getFile" | 7 | :http-request="getFile" |
8 | - :multiple="multiple" | 8 | + :multiple="true" |
9 | :before-upload="beforeUpload" | 9 | :before-upload="beforeUpload" |
10 | - :on-change="handleChange" | ||
11 | - :file-list="fileListNow" | ||
12 | :auto-upload="false"> | 10 | :auto-upload="false"> |
13 | <template #trigger> | 11 | <template #trigger> |
14 | <el-button size="small" type="primary">{{btnText}}</el-button> | 12 | <el-button size="small" type="primary">{{btnText}}</el-button> |
@@ -27,7 +25,6 @@ | @@ -27,7 +25,6 @@ | ||
27 | </template> | 25 | </template> |
28 | </el-upload> | 26 | </el-upload> |
29 | <div class="text-tip" style="position: absolute;bottom:30px;left: 20px;color:#f78989"> | 27 | <div class="text-tip" style="position: absolute;bottom:30px;left: 20px;color:#f78989"> |
30 | - <span v-if="!multiple">单文件上传,</span> | ||
31 | 文件上传大小限制200M | 28 | 文件上传大小限制200M |
32 | </div> | 29 | </div> |
33 | </template> | 30 | </template> |
@@ -46,11 +46,6 @@ export default { | @@ -46,11 +46,6 @@ export default { | ||
46 | type: String, | 46 | type: String, |
47 | default: '' | 47 | default: '' |
48 | }, | 48 | }, |
49 | - //lsq 是否为多文件上传 2022-03-30 | ||
50 | - multiple:{ | ||
51 | - type: Boolean, | ||
52 | - default: false | ||
53 | - }, | ||
54 | accept: { | 49 | accept: { |
55 | type: String, | 50 | type: String, |
56 | default: [".3gpp", | 51 | default: [".3gpp", |
@@ -145,17 +140,6 @@ export default { | @@ -145,17 +140,6 @@ export default { | ||
145 | } | 140 | } |
146 | 141 | ||
147 | } | 142 | } |
148 | - //start lsq 单文件上传时 新文件覆盖旧文件 2022-03-30 | ||
149 | - let fileListNow=props.fileList?Vue.ref(props.fileList):Vue.ref([]); | ||
150 | - let handleChange=(file, fileList)=> { | ||
151 | - if(!props.multiple){ | ||
152 | - if (fileList.length > 0) { | ||
153 | - fileListNow.value= [fileList[fileList.length - 1]] // 这一步,是 展示最后一次选择的文件 | ||
154 | - } | ||
155 | - } | ||
156 | - | ||
157 | - } | ||
158 | - //end lsq 2022-03-30 | ||
159 | 143 | ||
160 | let fileChange = (file, fileList) =>{ | 144 | let fileChange = (file, fileList) =>{ |
161 | console.log(file, fileList); | 145 | console.log(file, fileList); |
@@ -198,9 +182,7 @@ export default { | @@ -198,9 +182,7 @@ export default { | ||
198 | uploadFile, | 182 | uploadFile, |
199 | hidedialog, | 183 | hidedialog, |
200 | beforeUpload, | 184 | beforeUpload, |
201 | - fileChange, | ||
202 | - handleChange, | ||
203 | - fileListNow | 185 | + fileChange |
204 | } | 186 | } |
205 | } | 187 | } |
206 | } | 188 | } |
-
Please register or login to post a comment