Skip to content

Commit

Permalink
feat: 调整消息布局以便扩展
Browse files Browse the repository at this point in the history
  • Loading branch information
Chanzhaoyu committed Feb 13, 2023
1 parent 727562f commit 73c9ac4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
16 changes: 13 additions & 3 deletions src/components/business/Chat/components/Message/Text.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
<script lang="ts" setup>
interface Props {
reversal?: boolean
}
defineProps<Props>()
</script>

<template>
<span class="leading-relaxed whitespace-pre-wrap">
<slot />
</span>
<div class="p-2 mt-2 rounded-md" :class="[reversal ? 'bg-[#d2f9d1]' : 'bg-[#f4f6f8]']">
<span class="leading-relaxed whitespace-pre-wrap">
<slot />
</span>
</div>
</template>
6 changes: 3 additions & 3 deletions src/components/business/Chat/components/Message/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ defineProps<Props>()
<span class="text-xs text-[#b4bbc4]">
{{ dateTime }}
</span>
<div class="p-2 mt-2 rounded-md" :class="[reversal ? 'bg-[#d2f9d1]' : 'bg-[#f4f6f8]']">
<Text>{{ message }}</Text>
</div>
<Text :reversal="reversal">
{{ message }}
</Text>
</div>
</div>
</template>
2 changes: 1 addition & 1 deletion src/components/business/Chat/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ function addMessage(message: string, reversal = false) {
<div class="flex items-center justify-between space-x-2">
<HoverButton tooltip="Clear conversations" @click="handleClear">
<span class="text-xl text-[#4f555e]">
<SvgIcon icon="ri:refresh-line" />
<SvgIcon icon="ri:delete-bin-line" />
</span>
</HoverButton>
<NInput v-model:value="prompt" placeholder="Type a message..." @keypress="handleEnter" />
Expand Down

0 comments on commit 73c9ac4

Please sign in to comment.