图片上传

320 阅读1分钟
<u-upload :custom-btn="true" ref="uUpload" @on-uploaded="onListChangethree()" :action="action"
        max-count="1" width="240" height="150" upload-text="选择图片">
        <view slot="addBtn" class="slot-btn">
                <image :src="logo" style="width:200rpx ;height:76rpx ;" mode="aspectFill"></image>
        </view>
</u-upload>

methods:{
    onListChangethree(lists) {
            console.log("sddssd")
            this.logo = lists[0].response.data
    },
    为空判断
    if (this.logo == '') {
        this.$u.toast('请上传logo')
        return
    }
},
onLoad() {
        this.$u.api.ryGalleryInfo({
                id: uni.getStorageSync('galleryId')
        }).then((res) => {
                console.log('onload',res)
                this.info = res.data;
                if (res.data.logo !== '') {
                        this.logo = res.data.logo;
                } else {
                        this.logo = "https://xiyanluo.oss-cn-beijing.aliyuncs.com/0%E5%A6%82%E6%84%8F/addImg.png";
                }
        });
},