当前位置:网站首页>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>
边栏推荐
- Hash table, hash function, bloom filter, consistency hash
- 用快解析内网穿透实现零成本自建网站
- [Peking University] tensorflow2.0-1-opening
- Jar批量管理小工具
- [paper reading] cavemix: a simple data augmentation method for brain vision segmentation
- Mit-6.824-lab4b-2022 (10000 word idea explanation - code construction)
- How to reduce the stock account Commission and stock speculation commission? Is it safe to open an online account
- Introduction to ACM combination counting
- 如果炒股开华泰证券的户,在网上开户安全吗?
- How to avoid arc generation—— Aafd fault arc detector solves the problem for you
猜你喜欢
How many triangles are there in the golden K-line diagram?
业务场景功能的继续修改
电力运维云平台:开启电力系统“无人值班、少人值守”新模式
Microservice
【雅思阅读】王希伟阅读P4(matching1)
Face recognition 5- insight face padding code practice notes
公司要上监控,Zabbix 和 Prometheus 怎么选?这么选准没错!
Robot reinforcement learning synergies between pushing and grassing with self supervised DRL (2018)
C language to quickly solve the reverse linked list
Tester's algorithm interview question - find mode
随机推荐
微软禁用IE浏览器后,打开IE浏览器闪退解决办法
人生无常,大肠包小肠, 这次真的可以回家看媳妇去了。。。
青海省国家湿地公园功能区划数数据、全国湿地沼泽分布数据、全国省市县自然保护区
Intelligence test to see idioms guess ancient poems wechat applet source code
Etcd database source code analysis - brief process of processing entry records
How to do the project of computer remote company in foreign Internet?
业务场景功能的继续修改
图解网络:什么是网关负载均衡协议GLBP?
业务实现-日志写到同一个行数据里面
实战模拟│JWT 登录认证
Solve the problem that the virtual machine cannot be remotely connected through SSH service
French scholars: the explicability of counter attack under optimal transmission theory
Go step on the pit - no required module provides package: go mod file not found in current directory or any parent
Fast analysis -- easy to use intranet security software
The company needs to be monitored. How do ZABBIX and Prometheus choose? That's the right choice!
C language to quickly solve the reverse linked list
Five papers recommended for the new development of convolutional neural network in deep learning
【雅思阅读】王希伟阅读P4(matching2段落信息配对题【困难】)
After Microsoft disables the IE browser, open the IE browser to flash back the solution
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