裂变星小程序-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.
 
 
 

58 lines
1011 B

<template>
<view>
<uv-upload
:accept="accept"
:maxCount="1"
:width="width"
:height="height"
:previewImage="false"
@afterRead="afterRead"
@delete="deleteFile"
>
<slot :value="value"></slot>
</uv-upload>
</view>
</template>
<script>
export default {
props: {
value: {
default: null
},
accept: {
type: String,
default: 'image' // all | media | image | file | video
},
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){
this.$Oss.ossUpload(e.file.url).then(url => {
this.fileList = [url]
this.$emit('input', url)
})
},
},
}
</script>
<style scoped lang="scss">
</style>