当前位置:网站首页>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 company needs to be monitored. How do ZABBIX and Prometheus choose? That's the right choice!
- 人脸识别5- insight-face-paddle-代码实战笔记
- Font design symbol combination multifunctional wechat applet source code
- Summary of week 22-07-02
- Hologres Query管理及超时处理
- In June, the list of winners of "Moli original author program" was announced! Invite you to talk about the domestic database
- 45岁教授,她投出2个超级独角兽
- How long does it take to obtain a PMP certificate?
- Consolidated expression C case simple variable operation
猜你喜欢
他做国外LEAD,用了一年时间,把所有房贷都还清了
电力运维云平台:开启电力系统“无人值班、少人值守”新模式
[path planning] RRT adds dynamic model for trajectory planning
「运维有小邓」域密码策略强化器
French scholars: the explicability of counter attack under optimal transmission theory
巩固表达式C# 案例简单变量运算
Consolidated expression C case simple variable operation
如何避免电弧产生?—— AAFD故障电弧探测器为您解决
Ap8022 switching power supply small household appliances ACDC chip offline switching power supply IC
业务场景功能的继续修改
随机推荐
Combien de temps faut - il pour obtenir un certificat PMP?
[JS] - [dynamic planning] - Notes
[JS] - [sort related] - Notes
Pytoch --- use pytoch to realize linknet for semantic segmentation
模板的进阶
Mit-6.824-lab4b-2022 (10000 word idea explanation - code construction)
IELTS examination process, what to pay attention to and how to review?
Solve the problem that the virtual machine cannot be remotely connected through SSH service
Consolidated expression C case simple variable operation
Expand your kubecl function
青海省国家湿地公园功能区划数数据、全国湿地沼泽分布数据、全国省市县自然保护区
解决无法通过ssh服务远程连接虚拟机
认识ThreadPoolExecutor
If you open an account of Huatai Securities by stock speculation, is it safe to open an account online?
Financial markets, asset management and investment funds
Enterprise application business scenarios, function addition and modification of C source code
Actual combat simulation │ JWT login authentication
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
[monitoring] ZABBIX
How to avoid arc generation—— Aafd fault arc detector solves the problem for you