feat: 长文本组件的调试
This commit is contained in:
@@ -5,15 +5,15 @@
|
||||
<view class="flex flex-col p-16 border-box">
|
||||
<view class="flex flex-row flex-items-center justify-center">
|
||||
<uni-icons class="icon-active" type="fire-filled" size="18" color="opacity" />
|
||||
<text class="font-size-16 font-500 text-color-900 ml-6">游玩划重点</text>
|
||||
<text class="font-size-16 font-500 text-color-900 ml-6">{{ title }}</text>
|
||||
</view>
|
||||
<!-- 文字内容,最多显示3行 -->
|
||||
<view class="answer-content font-size-12 font-color-600 mt-8">
|
||||
{{ answerText }}
|
||||
<ChatMarkdown :text="answerText" />
|
||||
</view>
|
||||
<!-- 超过3行时显示...提示 -->
|
||||
<view class="fles flex-row mt-8" v-if="isOverflow">
|
||||
<text class="font-size-12 font-400 theme-color-500 mr-4">查看完整攻略</text>
|
||||
<view class="fles flex-row mt-8" v-if="isOverflow" @click="lookDetailAction">
|
||||
<text class="font-size-12 font-400 theme-color-500 mr-4">查看详情</text>
|
||||
<uni-icons class="icon-active" type="right" size="14" color="opacity"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
@@ -22,12 +22,17 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { ref, defineProps } from 'vue'
|
||||
import ChatMarkdown from "../../chat/ChatMarkdown/index.vue";
|
||||
|
||||
const isOverflow = ref(true)
|
||||
|
||||
// 直接根据文字长度判断,超过约100个字符认为会溢出(约3行)
|
||||
const props = defineProps({
|
||||
title: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
answerText: {
|
||||
type: String,
|
||||
default: "",
|
||||
@@ -37,6 +42,12 @@ const props = defineProps({
|
||||
// 简单判断:12号字体3行约100个字符
|
||||
isOverflow.value = props.answerText.length > 100
|
||||
|
||||
const lookDetailAction = () => {
|
||||
uni.navigateTo({
|
||||
url: `/pages/long-answer/index?message=${props.answerText}`,
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
Reference in New Issue
Block a user