fix: 修复部份 bug (#131)

* fix: 主题模式图标不一致的问题[#125]

* fix: 修复样式问题[#123][#126]

* perf: 优化代码和添加类型
This commit is contained in:
Redon
2023-02-25 22:44:25 +08:00
committed by GitHub
parent 628187f5c3
commit 1406292405
9 changed files with 68 additions and 76 deletions

View File

@@ -2,15 +2,7 @@
import { computed } from 'vue'
import { marked } from 'marked'
import hljs from 'highlight.js'
const props = defineProps<Props>()
marked.setOptions({
renderer: new marked.Renderer(),
highlight(code) {
return hljs.highlightAuto(code).value
},
})
import { useBasicLayout } from '@/hooks/useBasicLayout'
interface Props {
inversion?: boolean
@@ -19,12 +11,23 @@ interface Props {
loading?: boolean
}
const props = defineProps<Props>()
const { isMobile } = useBasicLayout()
marked.setOptions({
renderer: new marked.Renderer(),
highlight(code) {
return hljs.highlightAuto(code).value
},
})
const wrapClass = computed(() => {
return [
'text-wrap',
'p-3',
'min-w-[20px]',
'rounded-md',
isMobile.value ? 'p-2' : 'p-3',
props.inversion ? 'bg-[#d2f9d1]' : 'bg-[#f4f6f8]',
props.inversion ? 'dark:bg-[#a1dc95]' : 'dark:bg-[#1e1e20]',
{ 'text-red-500': props.error },

View File

@@ -13,7 +13,6 @@ interface Props {
interface Emit {
(ev: 'regenerate'): void
(ev: 'copy'): void
(ev: 'delete'): void
}
@@ -33,15 +32,15 @@ function handleRegenerate() {
<template>
<div class="flex w-full mb-6 overflow-hidden" :class="[{ 'flex-row-reverse': inversion }]">
<div
class="flex items-center justify-center rounded-full overflow-hidden flex-shrink-0 w-[32px] h-[32px]"
:class="[inversion ? 'ml-3' : 'mr-3']"
class="flex items-center justify-center flex-shrink-0 h-8 overflow-hidden rounded-full basis-8"
:class="[inversion ? 'ml-2' : 'mr-2']"
>
<AvatarComponent :image="inversion" />
</div>
<div class="flex flex-col flex-1 text-sm" :class="[inversion ? 'items-end' : 'items-start']">
<span class="text-xs text-[#b4bbc4]">
<div class="overflow-hidden text-sm " :class="[inversion ? 'items-end' : 'items-start']">
<p class="text-xs text-[#b4bbc4]" :class="[inversion ? 'text-right' : 'text-left']">
{{ dateTime }}
</span>
</p>
<div
class="flex items-end gap-2 mt-2"
:class="[inversion ? 'flex-row-reverse' : 'flex-row']"