Commit 7cce9705 by 前端

修复命名规则

1 parent e266b5f2
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
v-model="otherList" v-model="otherList"
:limit="limit" :limit="limit"
:status="status" :status="status"
:nameIndex="otherList.length"
@change="onChange('otherList')" @change="onChange('otherList')"
></ImageOtherUpload> ></ImageOtherUpload>
</div> </div>
......
...@@ -60,6 +60,10 @@ export default { ...@@ -60,6 +60,10 @@ export default {
type: [String, Number], type: [String, Number],
default: 20, default: 20,
}, },
nameIndex: {
type: Number,
default: 0,
},
}, },
data() { data() {
return { return {
...@@ -68,17 +72,16 @@ export default { ...@@ -68,17 +72,16 @@ export default {
readStatus: "", readStatus: "",
acceptFile: ".jpg,.png", acceptFile: ".jpg,.png",
previewList: [], previewList: [],
nameIndex:0
}; };
}, },
watch: { watch: {
value: { value: {
handler: function (n, o) { handler: function (n, o) {
this.imgList = n; this.imgList = n;
if(!this.nameIndex){ // if(!this.nameIndex){
this.nameIndex = n.length; // this.nameIndex = n.length;
} // }
console.log('666666666') // console.log('666666666')
}, },
}, },
status: { status: {
...@@ -88,8 +91,7 @@ export default { ...@@ -88,8 +91,7 @@ export default {
immediate: true, immediate: true,
}, },
}, },
mounted() { mounted() {},
},
methods: { methods: {
// 监听选择图片 // 监听选择图片
onChange(file, fileList) { onChange(file, fileList) {
...@@ -150,9 +152,12 @@ export default { ...@@ -150,9 +152,12 @@ export default {
console.log(res); console.log(res);
let response = res.data; let response = res.data;
if (response.returnCode == 0) { if (response.returnCode == 0) {
_this.imgList.push({ path: response.data, name: `照片${_this.nameIndex+1}` }); _this.imgList.push({
path: response.data,
name: `照片${_this.nameIndex + 1}`,
});
_this.previewList.push(res.data); _this.previewList.push(res.data);
_this.nameIndex +=1; _this.nameIndex += 1;
console.log(_this.imgList); console.log(_this.imgList);
// //
//this.$emit("change", response.data); //this.$emit("change", response.data);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!