| 1234567891011121314151617181920212223242526272829303132333435 |
- <template>
- <div class="avatar-img" :class="{'radius': radius}" :style="{width: width + 'rpx', height: width + 'rpx', borderRadius: radius}">
- <image :style="{width: width + 'rpx', height: width + 'rpx', borderRadius: radius}" :src="imgUrl" mode="scaleToFill" >
- </div>
- </template>
- <script>
- import defaultImg from '@/static/images/user/attr-default.png'
- export default {
- name: 'avatar-module',
- props: {
- width: {
- type: Number,
- default: 100
- },
- src: {
- type: String,
- default: ''
- },
- // 圆角数
- radius: {
- type: String,
- default: '50%'
- }
- },
- computed: {
- imgUrl() {
- return this.src || defaultImg
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- </style>
|