index.vue 959 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <template>
  2. <view class="avatar-image">
  3. <image class="image"
  4. :style="{ width: `${width}rpx`, height: `${width}rpx`, borderWidth: `${borderWidth}rpx`, borderColor: borderColor }"
  5. :src="url ? url : '/static/default-avatar.png'"></image>
  6. </view>
  7. </template>
  8. <script>
  9. export default {
  10. /**
  11. * 组件的属性列表
  12. * 用于组件自定义设置
  13. */
  14. props: {
  15. url: {
  16. type: String,
  17. default: ''
  18. },
  19. width: {
  20. type: Number,
  21. default: 90
  22. },
  23. borderWidth: {
  24. type: Number,
  25. default: 0
  26. },
  27. borderColor: {
  28. type: String,
  29. default: '#000000'
  30. }
  31. },
  32. data() {
  33. return {
  34. }
  35. },
  36. methods: {
  37. }
  38. }
  39. </script>
  40. <style lang="scss" scoped>
  41. .avatar-image {
  42. .image {
  43. display: block;
  44. width: 60rpx;
  45. height: 60rpx;
  46. border-radius: 50%;
  47. border-style: solid;
  48. }
  49. }
  50. </style>