| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <template>
- <view>
- <u-cell-group>
- <u-cell-item title="头像" @click="editAvatar">
- <image :src="avatarUrl" class="avatar"></image>
- </u-cell-item>
- <u-cell-item title="昵称" value="李宏杰" @click="editNickName"></u-cell-item>
- </u-cell-group>
- <u-modal v-model="show" :show-cancel-button="true" title="修改昵称">
- <view class="slot-content">
- <u-input v-model="value" />
- </view>
- </u-modal>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- show: false,
- avatarUrl:'/static/avatar.png',
- value: '李宏杰',
- }
- },
- onLoad(option) {
-
- },
- onShow(){
- },
- methods: {
- editNickName(){
- this.show = true
- },
- editAvatar(){
- let that = this
- uni.chooseImage({
- count: 1, //默认9
- sizeType: [ 'compressed'], //可以指定是原图还是压缩图,默认二者都有
- success: function (res) {
- that.avatarUrl = res.tempFilePaths[0]
- }
- });
- }
-
- },
-
- }
- </script>
- <style scope>
- .slot-content{
- margin: 30rpx;
- color: #606266;
- }
- .avatar{
- height: 70rpx;
- width: 70rpx;
-
- }
- page {
- background: #FFFFFF;
- }
- </style>
|