微信小程序-更换头像
生活随笔
收集整理的這篇文章主要介紹了
微信小程序-更换头像
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
<!-- 更換頭像 --><view class="updown-image" bindtap='upload'><view class="personal-img"><image src="{{head}}" mode="aspecFill"></image></view><text class="personal-text" mode="aspecFill" bindtap="headimage">點擊更換頭像</text></view>
.updown-image {width: 220rpx;height: 162rpx;border: 1rpx dashed #969696;margin: 37rpx auto;padding: 10rpx;text-align: center;margin-bottom: 145rpx;
}.personal-img {width: 160rpx;height: 160rpx;margin: 0 auto;
}.personal-img image {width: 100%;height: 100%;border-radius: 50%;box-shadow: 0px 2rpx 8rpx 0rpx rgba(150, 150, 150, 0.6);
}.personal-text {display: inline-block;font-size: 28rpx;font-family: PingFang-SC-Regular;font-weight: bold;color: rgba(50, 50, 50, 1);margin-top: 36rpx;width: 170rpx;}
Page({data: {showModal: false,head: "https://dj.zjl9.com/static/images/vivi.jpeg", },// 點擊換手機相冊或者電腦本地圖片 upload: function () {var _this = this;wx.chooseImage({count: 1, // 默認9 sizeType: ['original', 'compressed'],// 指定是原圖還是壓縮圖,默認兩個都有 sourceType: ['album', 'camera'],// 指定來源是相冊還是相機,默認兩個都有 success: function (res) {// 返回選定照片的本地文件路徑tempFilePath可以作為img標簽的src屬性顯示圖片 _this.setData({head: res.tempFilePaths})}})},
?
總結
以上是生活随笔為你收集整理的微信小程序-更换头像的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: JPG转EPS
- 下一篇: ITパスポート5天学习笔记④_Rx