调整内容显示

This commit is contained in:
aixianling
2023-05-12 18:04:58 +08:00
parent 795f6cd652
commit cd8e0f57aa
7 changed files with 5440 additions and 28 deletions

View File

@@ -3,21 +3,15 @@
<div class="chat-wrapper" v-for="item in list" :key="item.id">
<div class="chat-friend" v-if="item.uid !== 'me'">
<div class="chat-text" v-if="item.chatType == 0">
<icon-copy @click="$copy(item.msg, '已复制')"/>
<markdown-it-vue :content="item.msg.trim()"/>
<icon-copy @click="copy(item.msg, '已复制')"/>
<v-md-preview-html :html="item.msg.trim()" preview-class="vuepress-markdown-body"/>
</div>
<div class="chat-img" v-if="item.chatType == 1">
<img :src="item.msg" alt="表情" v-if="item.extend.imgType == 1" style="width: 100px; height: 100px"/>
<el-image style="border-radius: 10px" :src="item.msg" :preview-src-list="srcImgList" v-else>
</el-image>
</div>
<div class="chat-img" v-if="item.chatType == 2">
<div class="word-file">
<FileCard :fileType="item.extend.fileType" :file="item.msg"></FileCard>
</div>
<el-image style="border-radius: 10px" :src="item.msg" :preview-src-list="srcImgList" v-else/>
</div>
<div class="info-time">
<img :src="item.headImg" alt=""/>
<img :src="item.avatar" alt=""/>
<span>{{ item.name }}</span>
<span>{{ item.time }}</span>
</div>
@@ -29,7 +23,7 @@
<div class="info-time">
<span>{{ item.name }}</span>
<span>{{ item.time }}</span>
<img :src="item.headImg" alt=""/>
<img :src="item.avatar" alt=""/>
</div>
</div>
</div>
@@ -37,6 +31,7 @@
</template>
<script>
import {copyToClipboard} from "src/utils/tools";
import IconCopy from "../icons/iconCopy";
export default {
@@ -54,6 +49,11 @@ export default {
// 当滚动到底部,设置 isAutoScroll 为 true
this.isAutoScroll = scrollTop + offsetHeight === scrollHeight;
},
copy(msg) {
if (copyToClipboard(msg)) {
this.$message.success("已复制")
}
}
},
created() {