Commit 94341282 by lijiabin

【线上优化】 fix: 修复问吧详情【展开全部/收起】的bug

parent 6f582a53
...@@ -451,20 +451,17 @@ const questionContentRef = useTemplateRef<HTMLElement>('questionContentRef') ...@@ -451,20 +451,17 @@ const questionContentRef = useTemplateRef<HTMLElement>('questionContentRef')
const isExpand = ref(false) const isExpand = ref(false)
// 检测当前是否超过三行 要用到具体的dom // 检测当前是否超过三行 要用到具体的dom
const isOverThreeLine = ref(false) const isOverThreeLine = computed(() => {
const checkIsOverThreeLine = () => {
if (!questionContentRef.value || !questionDetail.value.content) return false if (!questionContentRef.value || !questionDetail.value.content) return false
const lineHeight = parseFloat(getComputedStyle(questionContentRef.value).lineHeight) const lineHeight = parseFloat(getComputedStyle(questionContentRef.value).lineHeight)
const height = questionContentRef.value!.scrollHeight const height = questionContentRef.value!.scrollHeight
const maxHeight = lineHeight * 3 const maxHeight = lineHeight * 3
return height > maxHeight return height > maxHeight
} })
const getQuestionDetail = async () => { const getQuestionDetail = async () => {
const { data } = await getArticleDetail(questionId) const { data } = await getArticleDetail(questionId)
questionDetail.value = data questionDetail.value = data
await nextTick()
isOverThreeLine.value = checkIsOverThreeLine()
} }
const { list, total, searchParams, goToPage, refresh } = usePageSearch(getCommentList, { const { list, total, searchParams, goToPage, refresh } = usePageSearch(getCommentList, {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment