feat: 登录也样式优化
This commit is contained in:
@@ -1,73 +1,73 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="container">
|
<view class="container">
|
||||||
<view class="chat-ai">
|
<view class="chat-ai">
|
||||||
<ChatMarkdown
|
<ChatMarkdown :key="textKey" :text="processedText" />
|
||||||
:key="textKey"
|
<slot name="content"></slot>
|
||||||
:text="processedText"
|
</view>
|
||||||
></ChatMarkdown>
|
<slot name="footer"></slot>
|
||||||
<slot name="content"></slot>
|
</view>
|
||||||
</view>
|
|
||||||
<slot name="footer"></slot>
|
|
||||||
</view>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { defineProps, computed, ref, watch } from "vue";
|
import { defineProps, computed, ref, watch } from "vue";
|
||||||
import ChatMarkdown from "./ChatMarkdown.vue";
|
import ChatMarkdown from "./ChatMarkdown.vue";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
text: {
|
text: {
|
||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: "",
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// 用于强制重新渲染的key
|
// 用于强制重新渲染的key
|
||||||
const textKey = ref(0);
|
const textKey = ref(0);
|
||||||
|
|
||||||
// 处理文本内容
|
// 处理文本内容
|
||||||
const processedText = computed(() => {
|
const processedText = computed(() => {
|
||||||
if (!props.text) {
|
if (!props.text) {
|
||||||
return '';
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
// 确保文本是字符串类型
|
// 确保文本是字符串类型
|
||||||
const textStr = String(props.text);
|
const textStr = String(props.text);
|
||||||
|
|
||||||
// 处理加载状态的文本
|
// 处理加载状态的文本
|
||||||
if (textStr.includes('加载中') || textStr.includes('...')) {
|
if (textStr.includes("加载中") || textStr.includes("...")) {
|
||||||
return textStr;
|
return textStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return textStr;
|
return textStr;
|
||||||
});
|
});
|
||||||
|
|
||||||
// 监听text变化,强制重新渲染
|
|
||||||
watch(() => props.text, (newText, oldText) => {
|
|
||||||
if (newText !== oldText) {
|
|
||||||
textKey.value++;
|
|
||||||
}
|
|
||||||
}, { immediate: true });
|
|
||||||
|
|
||||||
|
// 监听text变化,强制重新渲染
|
||||||
|
watch(
|
||||||
|
() => props.text,
|
||||||
|
(newText, oldText) => {
|
||||||
|
if (newText !== oldText) {
|
||||||
|
textKey.value++;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.container {
|
.container {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
max-width: 100%; // ✅ 限制最大宽度
|
max-width: 100%; // ✅ 限制最大宽度
|
||||||
overflow-x: hidden; // ✅ 防止横向撑开
|
overflow-x: hidden; // ✅ 防止横向撑开
|
||||||
|
|
||||||
.chat-ai {
|
.chat-ai {
|
||||||
margin: 6px 12px;
|
margin: 6px 12px;
|
||||||
padding: 0 12px;
|
padding: 0 12px;
|
||||||
|
|
||||||
min-width: 80px;
|
min-width: 80px;
|
||||||
background: rgba(255,255,255,0.4);
|
background: rgba(255, 255, 255, 0.4);
|
||||||
box-shadow: 2px 2px 6px 0px rgba(0,0,0,0.1);
|
box-shadow: 2px 2px 6px 0px rgba(0, 0, 0, 0.1);
|
||||||
border-radius: 4px 20px 20px 20px;
|
border-radius: 4px 20px 20px 20px;
|
||||||
border: 1px solid;
|
border: 1px solid;
|
||||||
border-color: #FFFFFF;
|
border-color: #ffffff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
.login-title {
|
.login-title {
|
||||||
width: 137px;
|
width: 137px;
|
||||||
|
height: 32px;
|
||||||
margin: 6px auto;
|
margin: 6px auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user