set-avatar.vue 653 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <template>
  2. <view :class="{dark: pattern=='dark'}">
  3. <view class="flex-center mar-t-100" @click="handlerChange">
  4. <u-avatar :src="avatar" size="200"></u-avatar>
  5. </view>
  6. </view>
  7. </template>
  8. <script>
  9. export default {
  10. data() {
  11. return {
  12. avatar: ''
  13. }
  14. },
  15. onShow() {},
  16. methods: {
  17. handlerChange() {
  18. uni.chooseImage({
  19. count: 1, //默认9
  20. // sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
  21. crop: {
  22. width: 1,
  23. height: 1
  24. },
  25. success: function(res) {
  26. console.log(JSON.stringify(res.tempFilePaths));
  27. }
  28. });
  29. }
  30. }
  31. }
  32. </script>
  33. <style>
  34. </style>