当前位置:网站首页>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>
边栏推荐
- 模板的进阶
- Significance of acrel EMS integrated energy efficiency platform in campus construction
- PermissionError: [Errno 13] Permission denied: ‘data. csv‘
- OSEK standard ISO_ 17356 summary introduction
- Selected cutting-edge technical articles of Bi Ren Academy of science and technology
- 打新债开户注册安全吗?有没有风险的?靠谱吗?
- If you open an account of Huatai Securities by stock speculation, is it safe to open an account online?
- [path planning] RRT adds dynamic model for trajectory planning
- [JS] - [dynamic planning] - Notes
- Face recognition 5- insight face padding code practice notes
猜你喜欢
Consolidated expression C case simple variable operation
机器人强化学习——Learning Synergies between Pushing and Grasping with Self-supervised DRL (2018)
Using fast parsing intranet penetration to realize zero cost self built website
企业里Win10 开启BitLocker锁定磁盘,如何备份系统,当系统出现问题又如何恢复,快速恢复又兼顾系统安全(远程设备篇)
人脸识别5- insight-face-paddle-代码实战笔记
OSEK standard ISO_ 17356 summary introduction
[paper reading] Tun det: a novel network for meridian ultra sound nodule detection
Summer challenge brings you to play harmoniyos multi terminal piano performance
Selected cutting-edge technical articles of Bi Ren Academy of science and technology
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
随机推荐
[论文阅读] CarveMix: A Simple Data Augmentation Method for Brain Lesion Segmentation
使用快解析搭建自己的minecraft服务器
[paper reading] cavemix: a simple data augmentation method for brain vision segmentation
【北京大学】Tensorflow2.0-1-开篇
Is it safe to open an account in the College of Finance and economics? How to open an account?
Specification for fs4061a boost 8.4v charging IC chip and fs4061b boost 12.6V charging IC chip datasheet
积分商城游戏设置的基本要点
How to avoid arc generation—— Aafd fault arc detector solves the problem for you
Meet ThreadPoolExecutor
Advanced template
Five papers recommended for the new development of convolutional neural network in deep learning
如何避免电弧产生?—— AAFD故障电弧探测器为您解决
Expand your kubecl function
Basic points of the game setup of the points mall
Réseau graphique: Qu'est - ce que le Protocole d'équilibrage de charge de passerelle glbp?
Hologres Query管理及超时处理
Illustrated network: what is gateway load balancing protocol GLBP?
Build your own minecraft server with fast parsing
华泰证券低佣金的开户链接安全吗?
Using the uniapp rich text editor