app-avatar.vue 696 B

1234567891011121314151617181920212223242526272829303132333435
  1. <template>
  2. <div class="avatar-img" :class="{'radius': radius}" :style="{width: width + 'rpx', height: width + 'rpx', borderRadius: radius}">
  3. <image :style="{width: width + 'rpx', height: width + 'rpx', borderRadius: radius}" :src="imgUrl" mode="scaleToFill" >
  4. </div>
  5. </template>
  6. <script>
  7. import defaultImg from '@/static/images/user/attr-default.png'
  8. export default {
  9. name: 'avatar-module',
  10. props: {
  11. width: {
  12. type: Number,
  13. default: 100
  14. },
  15. src: {
  16. type: String,
  17. default: ''
  18. },
  19. // 圆角数
  20. radius: {
  21. type: String,
  22. default: '50%'
  23. }
  24. },
  25. computed: {
  26. imgUrl() {
  27. return this.src || defaultImg
  28. }
  29. }
  30. }
  31. </script>
  32. <style lang="scss" scoped>
  33. </style>