当前位置:网站首页>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>
边栏推荐
猜你喜欢
Application of multi loop instrument in base station "switching to direct"
Etcd database source code analysis - brief process of processing entry records
[JS] - [sort related] - Notes
Fast parsing intranet penetration helps enterprises quickly achieve collaborative office
Date time type and format in MySQL
Blue sky nh55 series notebook memory reading and writing speed is extremely slow, solution process record
企业公司项目开发好一部分基础功能,重要的事保存到线上第一a
js如何实现数组转树
他做国外LEAD,用了一年时间,把所有房贷都还清了
"Xiaodeng" domain password policy enhancer in operation and maintenance
随机推荐
Specification for fs4061a boost 8.4v charging IC chip and fs4061b boost 12.6V charging IC chip datasheet
PaddleOCR教程
他做国外LEAD,用了一年时间,把所有房贷都还清了
A new method for analyzing the trend chart of London Silver
基于三维gis平台的消防系统运用
Is it safe to open an account in the College of Finance and economics? How to open an account?
Face recognition 5- insight face padding code practice notes
Advanced template
S32 design studio for arm 2.2 quick start
Cross domain request
ICML 2022 | 3dlinker: e (3) equal variation self encoder for molecular link design
OSEK standard ISO_ 17356 summary introduction
Date time type and format in MySQL
人生无常,大肠包小肠, 这次真的可以回家看媳妇去了。。。
快解析——好用的内网安全软件
In June, the list of winners of "Moli original author program" was announced! Invite you to talk about the domestic database
城市轨道交通站应急照明疏散指示系统设计
js正则表达式之中文验证(转)
香港珠宝大亨,22亿“抄底”佐丹奴
[JS] - [dynamic planning] - Notes