8***@qq.com
8***@qq.com
  • 发布:2020-12-10 17:42
  • 更新:2020-12-10 17:42
  • 阅读:444

头部图片上传

分类:uni-app

<template>
<view class="service">
<view class="content" @click="uploadImg">
<image v-for="(item,index) in imgArr" :src="item" mode="widthFix"></image>
<image src="../../static/img/10.jpg" mode="widthFix" v-show="shows"></image>
</view>
</view>
</template>

<script>
export default {
data() {
return {
imgArr:[],
shows:true
}
},
onLoad() {

        },  
        methods: {  
            uploadImg(){  
                if(this.shows){  
                    this.shows=false  
                }  
                let that = this  
                uni.chooseImage({  
                    success(res) {  
                        console.log(res.tempFilePaths)  
                        that.imgArr = res.tempFilePaths;  
                        console.log(that.imgArr)  
                        }  
                })  
            }  
        }  
    }  

</script>
<style>
.content{width: 100%;text-align: center;}
.content image{width:80px;border-radius: 50%;}
</style>

0 关注 分享

要回复文章请先登录注册