|
@@ -14,11 +14,11 @@
|
|
|
right: fixed ? right : 0,
|
|
|
bottom: fixed ? bottom : 0,
|
|
|
border: borderStyle,
|
|
|
- 'margin-left': marginLeft
|
|
|
+ 'margin-left': avatarGroup.margin + 'rpx'
|
|
|
}"
|
|
|
@click="handleClick"
|
|
|
>
|
|
|
- <image class="fs-avatar-img" :src="src" v-if="src" :lazy-load="lazyLoad" :mode="imageMode" />
|
|
|
+ <image class="fs-avatar-img" :src="src" v-if="src" :lazy-load="lazyLoad" :mode="imageMode" @click="handlePreview" />
|
|
|
<view v-else class="fs-avatar-slot" :class="['bg-' + bgColorType]" :style="{backgroundColor:bgColor}">
|
|
|
<slot></slot>
|
|
|
</view>
|
|
@@ -65,6 +65,7 @@ const props = defineProps({
|
|
|
type: String,
|
|
|
default: 'scaleToFill'
|
|
|
},
|
|
|
+ preview: Boolean,
|
|
|
radius: Boolean,
|
|
|
link: String,
|
|
|
linkType: {
|
|
@@ -84,9 +85,11 @@ const props = defineProps({
|
|
|
|
|
|
const emits = defineEmits(['click'])
|
|
|
|
|
|
-const marginLeft = inject('marginLeft', 0)
|
|
|
+const avatarGroup = inject('avatarGroup', {})
|
|
|
|
|
|
-const borderStyle = computed(() => props.border ? `${ props.borderWidth} solid ${ props.borderColor}` : 'none')
|
|
|
+const borderStyle = computed(() => {
|
|
|
+ return (props.border || avatarGroup.border) ? `${ props.borderWidth} solid ${ props.borderColor}` : 'none'
|
|
|
+})
|
|
|
|
|
|
const handleClick = () => {
|
|
|
if (props.link) {
|
|
@@ -95,6 +98,14 @@ const handleClick = () => {
|
|
|
})
|
|
|
}
|
|
|
emits('click')
|
|
|
+}
|
|
|
+
|
|
|
+const handlePreview = () => {
|
|
|
+ if (props.preview) {
|
|
|
+ uni.previewImage({
|
|
|
+ urls: [props.src]
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
</script>
|
|
|
|