Files
ZhHealth/pages/im/components/showImage.nvue
2022-02-08 09:42:48 +08:00

61 lines
1.4 KiB
Plaintext

<template>
<view class="msg--image" :class="guest ? 'right': 'left'">
<image class="img" :src="msg.thumbnail" @click="previewImage" mode="widthFix"></image>
</view>
</template>
<script>
export default {
name: 'showImage',
props: {
msg: {
type: Object,
default: () => {
return {
local: '',
remote: '',
objectName: '',
thumbnail: '',
isFull: false
}
}
},
guest: {
type: Boolean,
default: true
}
},
methods: {
previewImage() {
uni.previewImage({
urls: [
this.msg.remote
],
current: 1
})
}
}
}
</script>
<style scoped lang="scss">
.msg--image {
padding: 20rpx;
&.left {
border-radius: 0 20rpx 20rpx 20rpx;
background: white;
}
&.right {
border-radius: 20rpx 0 20rpx 20rpx;
background: #34CE98;
}
.img {
width: 150rpx;
border-radius: 10rpx;
}
}
</style>