This commit is contained in:
aixianling
2023-03-31 10:24:12 +08:00
parent 8c89b3b418
commit daefc25b4b
3 changed files with 25 additions and 7 deletions

View File

@@ -40,6 +40,10 @@ import AiImage from '../AiImage/AiImage'
export default {
name: 'AiUploader',
components: {AiImage},
model:{
prop: 'def',
event: 'input'
},
props: {
limit: {default: 1}, //数量
placeholder: {default: '添加图片'}, // 文字提示
@@ -86,7 +90,7 @@ export default {
methods: {
remove(index) {
this.fileList.splice(index, 1)
this.$emit('list', this.fileList)
this.$emit('input', this.fileList)
},
upload(wait) {
let count = this.limit - (this.fileList?.length || 0)
@@ -145,8 +149,6 @@ export default {
this.$u.toast('上传成功!')
if (this.action.endsWith('/file/add')) {
this.fileList.push({url: res.data?.[0]?.split(";")?.[0], id: res.data?.[0]?.split(";")?.[1]})
this.$emit('input', [...this.fileList])
this.$emit('change', [...this.fileList])
} else if (this.action == '/admin/file/add2') {
let info = res.data
this.$emit('update:fileId', info?.id)
@@ -155,7 +157,7 @@ export default {
this.fileList.push({url: res.data?.split(";")?.[0], id: res.data?.split(";")?.[1]})
}
this.$emit("update:def", this.fileList)
this.$emit("list", this.fileList)
this.$emit("input", this.fileList)
} else {
this.$u.toast(res.msg)
}