当前位置:网站首页>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>
边栏推荐
- The input of uniapp is invalid except for numbers
- Continuous modification of business scenario functions
- Go pit - no required module provides Package: go. Mod file not found in current directory or any parent
- Is the account opening link of Huatai Securities with low commission safe?
- 业务实现-日志写到同一个行数据里面
- [IELTS reading] Wang Xiwei reads P4 (matching2 paragraph information matching question [difficult])
- C language to quickly solve the reverse linked list
- Fast analysis -- easy to use intranet security software
- Consolidated expression C case simple variable operation
- How to reduce the stock account Commission and stock speculation commission? Is it safe to open an online account
猜你喜欢

The company needs to be monitored. How do ZABBIX and Prometheus choose? That's the right choice!

如何用快解析自制IoT云平台

It's too convenient. You can complete the code release and approval by nailing it!

电力运维云平台:开启电力系统“无人值班、少人值守”新模式

XML的解析

What is the difference between port mapping and port forwarding

A new method for analyzing the trend chart of London Silver

How to apply for PMP project management certification examination?

The input of uniapp is invalid except for numbers

【雅思阅读】王希伟阅读P4(matching1)
随机推荐
[IELTS reading] Wang Xiwei reading P3 (heading)
香港珠宝大亨,22亿“抄底”佐丹奴
城市轨道交通站应急照明疏散指示系统设计
MIT-6.824-lab4B-2022(万字思路讲解-代码构建)
Acrel-EMS综合能效平台在校园建设的意义
45 year old professor, she threw two super unicorns
Significance of acrel EMS integrated energy efficiency platform in campus construction
Enterprise application business scenarios, function addition and modification of C source code
认识ThreadPoolExecutor
Skills in analyzing the trend chart of London Silver
实战模拟│JWT 登录认证
Jar批量管理小工具
Fast parsing intranet penetration helps enterprises quickly achieve collaborative office
Continuous modification of business scenario functions
微软禁用IE浏览器后,打开IE浏览器闪退解决办法
积分商城游戏设置的基本要点
JS how to realize array to tree
After Microsoft disables the IE browser, open the IE browser to flash back the solution
快解析内网穿透帮助企业快速实现协同办公
多回路仪表在基站“转改直”方面的应用