裂变星小程序-25.03.04
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

66 lines
1.1 KiB

<template>
<view>
<uv-upload
:fileList="fileList"
:multiple="multiple"
:maxCount="maxCount"
:width="width"
:height="height"
@afterRead="afterRead"
@delete="deleteFile"
>
<slot :value="value"></slot>
</uv-upload>
</view>
</template>
<script>
export default {
props: {
value: {
default: null
},
multiple: {
type: Boolean,
default: false,
},
maxCount: {
type: Number,
default: 1,
},
width: {
type: Number | String,
default: null,
},
height: {
type: Number | String,
default: null,
},
},
data() {
return {
fileList: [],
}
},
methods: {
deleteFile(){
this.fileList = []
this.$emit('input', null)
},
afterRead(e){
let self = this
e.file.forEach(file => {
self.$Oss.ossUpload(file.url).then(url => {
self.fileList = [url]
self.$emit('input', url)
})
})
},
},
}
</script>
<style scoped lang="scss">
</style>