Commit 9c48b908 authored by 赵啸非's avatar 赵啸非

更新附件添加多个设置

parent f7aff401
...@@ -113,23 +113,25 @@ export default { ...@@ -113,23 +113,25 @@ export default {
value: { value: {
handler(val) { handler(val) {
if (val) { if (val) {
let temp = 1;
// 首先将值转为数组 this.showFileList();
const filePathlist = this.value.split(','); // let temp = 1;
// 然后将数组转为对象数组 // // 首先将值转为数组
const fileNamelist =this.fileName.split(','); // const filePathlist = this.value.split(',');
for (var i = 0; i < filePathlist.length; i++) { // // 然后将数组转为对象数组
let item = {} // const fileNamelist =this.fileName.split(',');
console.log(fileNamelist.length===filePathlist.length) // for (var i = 0; i < filePathlist.length; i++) {
if(fileNamelist.length===filePathlist.length){ // let item = {}
item.name = fileNamelist[i]; // console.log(fileNamelist.length===filePathlist.length)
}else{ // if(fileNamelist.length===filePathlist.length){
item.name = filePathlist[i]; // item.name = fileNamelist[i];
} // }else{
item.url = filePathlist[i]; // item.name = filePathlist[i];
item.uid = new Date().getTime() + temp++; // }
this.fileList.push(item) // item.url = filePathlist[i];
} // item.uid = new Date().getTime() + temp++;
// this.fileList.push(item)
// }
} else { } else {
this.fileList = []; this.fileList = [];
return []; return [];
...@@ -145,6 +147,28 @@ export default { ...@@ -145,6 +147,28 @@ export default {
}, },
}, },
methods: { methods: {
showFileList(){
let temp = 1;
// 首先将值转为数组
const filePathlist = this.value.split(',');
// 然后将数组转为对象数组
const fileNamelist =this.fileName.split(',');
for (var i = 0; i < filePathlist.length; i++) {
let item = {}
console.log(fileNamelist.length === filePathlist.length)
if (fileNamelist.length === filePathlist.length) {
item.name = fileNamelist[i];
} else {
item.name = filePathlist[i];
}
item.url = filePathlist[i];
item.uid = new Date().getTime() + temp++;
this.fileList.push(item)
}
},
// 上传前校检格式和大小 // 上传前校检格式和大小
handleBeforeUpload(file) { handleBeforeUpload(file) {
// 校检文件类型 // 校检文件类型
...@@ -218,6 +242,8 @@ export default { ...@@ -218,6 +242,8 @@ export default {
} }
}, },
created() { created() {
console.log("file create")
this.showFileList();
// this.fileList = this.list; // this.fileList = this.list;
}, },
}; };
......
...@@ -102,7 +102,7 @@ function getComponent(fileName) { ...@@ -102,7 +102,7 @@ function getComponent(fileName) {
try { try {
return require('./views/' + fileName).default return require('./views/' + fileName).default
} catch (error) { } catch (error) {
console.log("error:",error) //console.log("error:",error)
return fileNotFound; return fileNotFound;
} }
} }
......
...@@ -125,8 +125,6 @@ ...@@ -125,8 +125,6 @@
}, },
/**获取数据后弹框 */ /**获取数据后弹框 */
afterRender(data) { afterRender(data) {
console.log(data)
console.log(this.form)
this.open = true; this.open = true;
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment