当前位置:网站首页>Upload avatar on uniapp
Upload avatar on uniapp
2022-07-05 00:05:00 【I'm happy】
<template>
<view>
<!-- // By default -->
<image v-if="!imgUrl" :src="require('../../static/nav/icon_me_n.svg')" class="headPhoto" @tap="openChooseImg"></image>
<!-- // The user clicks the modified -->
<image v-else :src="imgUrl" class="headPhoto"></image>
</view>
</template>
<script>
export default {
data() {
return {
imgUrl: ""
};
},
methods: {
openChooseImg() {
uni.chooseImage({
count: 1, // The maximum number of sheets that can be selected
sizeType: ['original', 'compressed'], // You can specify whether it is original or compressed , By default, both of them have
sourceType: ['album', 'camera'], // Select from the album , And camera functions , By default, both of them have
success: res => {
console.log(res, ' Head portrait res')
this.imgUrl = res.tempFilePaths[0] // Assign the selected avatar to imgurl
console.log(this.imgUrl, 'this.imgUrl')
}
});
},
},
};
</script>
<style lang="scss">
.timeBox {
margin-top: 50rpx;
}
</style>
边栏推荐
- 取得PMP证书需要多长时间?
- XML的解析
- 青海省国家湿地公园功能区划数数据、全国湿地沼泽分布数据、全国省市县自然保护区
- MP advanced operation: time operation, SQL, querywapper, lambdaquerywapper (condition constructor) quick filter enumeration class
- How many triangles are there in the golden K-line diagram?
- Is it safe to open and register new bonds? Is there any risk? Is it reliable?
- Combien de temps faut - il pour obtenir un certificat PMP?
- Cross domain request
- [path planning] RRT adds dynamic model for trajectory planning
- 取得PMP證書需要多長時間?
猜你喜欢
Etcd database source code analysis - brief process of processing entry records
用快解析内网穿透实现零成本自建网站
Significance of acrel EMS integrated energy efficiency platform in campus construction
微服务(Microservice)那点事儿
Summer challenge brings you to play harmoniyos multi terminal piano performance
[IELTS reading] Wang Xiwei reading P4 (matching1)
取得PMP证书需要多长时间?
Data on the number of functional divisions of national wetland parks in Qinghai Province, data on the distribution of wetlands and marshes across the country, and natural reserves in provinces, cities
[IELTS reading] Wang Xiwei reading P3 (heading)
How many triangles are there in the golden K-line diagram?
随机推荐
JS convert pseudo array to array
电力运维云平台:开启电力系统“无人值班、少人值守”新模式
「运维有小邓」域密码策略强化器
基于三维gis平台的消防系统运用
[IELTS reading] Wang Xiwei reads P4 (matching2 paragraph information matching question [difficult])
Why does infographic help your SEO
How to reduce the stock account Commission and stock speculation commission? Is it safe to open an online account
MP advanced operation: time operation, SQL, querywapper, lambdaquerywapper (condition constructor) quick filter enumeration class
S32 design studio for arm 2.2 quick start
OSEK standard ISO_ 17356 summary introduction
Réseau graphique: Qu'est - ce que le Protocole d'équilibrage de charge de passerelle glbp?
If you open an account of Huatai Securities by stock speculation, is it safe to open an account online?
Design of emergency lighting evacuation indication system for urban rail transit station
Best practice case of enterprise digital transformation: introduction and reference of cloud based digital platform system security measures
uniapp 除了数字,其他输入无效
After Microsoft disables the IE browser, open the IE browser to flash back the solution
Pytoch --- use pytoch to realize linknet for semantic segmentation
打新债开户注册安全吗?有没有风险的?靠谱吗?
Go step on the pit - no required module provides package: go mod file not found in current directory or any parent
How to effectively monitor the DC column head cabinet