当前位置:网站首页>uniapp上传头像
uniapp上传头像
2022-07-05 00:02:00 【我是开心呀】
<template>
<view>
<!-- //默认显示的 -->
<image v-if="!imgUrl" :src="require('../../static/nav/icon_me_n.svg')" class="headPhoto" @tap="openChooseImg"></image>
<!-- //用户点击修改的 -->
<image v-else :src="imgUrl" class="headPhoto"></image>
</view>
</template>
<script>
export default {
data() {
return {
imgUrl: ""
};
},
methods: {
openChooseImg() {
uni.chooseImage({
count: 1, //最多可选择的张数
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'], //从相册选择,和摄像头功能,默认二者都有
success: res => {
console.log(res, '头像res')
this.imgUrl = res.tempFilePaths[0] //把选择的头像赋值给imgurl
console.log(this.imgUrl, 'this.imgUrl')
}
});
},
},
};
</script>
<style lang="scss">
.timeBox {
margin-top: 50rpx;
}
</style>
边栏推荐
- He worked as a foreign lead and paid off all the housing loans in a year
- How to avoid arc generation—— Aafd fault arc detector solves the problem for you
- Basic points of the game setup of the points mall
- Solve the problem that the virtual machine cannot be remotely connected through SSH service
- Réseau graphique: Qu'est - ce que le Protocole d'équilibrage de charge de passerelle glbp?
- Instructions for go defer
- PMP证书续证流程
- In June, the list of winners of "Moli original author program" was announced! Invite you to talk about the domestic database
- 跨域请求
- Font design symbol combination multifunctional wechat applet source code
猜你喜欢
企业公司项目开发好一部分基础功能,重要的事保存到线上第一a
Tester's algorithm interview question - find mode
French scholars: the explicability of counter attack under optimal transmission theory
Etcd database source code analysis - brief process of processing entry records
【雅思阅读】王希伟阅读P4(matching1)
Solution record of jamming when using CAD to move bricks in high configuration notebook
ECCV 2022 | Tencent Youtu proposed disco: the effect of saving small models in self supervised learning
用快解析内网穿透实现零成本自建网站
MIT-6.824-lab4B-2022(万字思路讲解-代码构建)
如何避免电弧产生?—— AAFD故障电弧探测器为您解决
随机推荐
高配笔记本使用CAD搬砖时卡死解决记录
js如何实现数组转树
Netcore3.1 JSON web token Middleware
Acrel-EMS综合能效平台在校园建设的意义
Five papers recommended for the new development of convolutional neural network in deep learning
Using the uniapp rich text editor
圖解網絡:什麼是網關負載均衡協議GLBP?
Font design symbol combination multifunctional wechat applet source code
Nine Qi single chip microcomputer ny8b062d single key control four LED States
QT personal learning summary
Significance of acrel EMS integrated energy efficiency platform in campus construction
公司要上监控,Zabbix 和 Prometheus 怎么选?这么选准没错!
How to use fast parsing to make IOT cloud platform
如何避免电弧产生?—— AAFD故障电弧探测器为您解决
Life is changeable, and the large intestine covers the small intestine. This time, I can really go home to see my daughter-in-law...
C语言中sizeof操作符的坑
[IELTS reading] Wang Xiwei reading P3 (heading)
Combien de temps faut - il pour obtenir un certificat PMP?
Is the account opening link of Huatai Securities with low commission safe?
用快解析内网穿透实现零成本自建网站