Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
corporateCulture-qd
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王立鹏
corporateCulture-qd
Commits
387b0f7b
Commit
387b0f7b
authored
Dec 22, 2025
by
lijiabin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【需求 17679】 perf: 富文本默认字体大小调整,富文本支持图片预览
parent
86e61957
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
1 deletions
+44
-1
index.vue
src/components/common/ArticleContent/index.vue
+38
-1
index.vue
src/components/common/WangEditor/index.vue
+6
-0
No files found.
src/components/common/ArticleContent/index.vue
View file @
387b0f7b
...
...
@@ -100,7 +100,7 @@
</div>
</div>
<div
v-else
v-html=
"articleDetail.content"
/>
<div
v-else
v-html=
"articleDetail.content"
class=
"html-content"
v-image-preview=
"1111"
/>
<!-- 标签 -->
<div
class=
"flex flex-wrap gap-2 mt-6"
>
...
...
@@ -113,6 +113,15 @@
</span>
</div>
</div>
<!-- 富文本内容的 图片预览 -->
<el-image-viewer
v-if=
"showPreview"
:url-list=
"srcList"
show-progress
:teleported=
"true"
:initial-index=
"currentPreviewIndex"
@
close=
"showPreview = false"
/>
</div>
</
template
>
...
...
@@ -124,6 +133,7 @@ import ActionMore from '@/components/common/ActionMore/index.vue'
import
{
jumpToUserHomePage
}
from
'@/utils'
import
{
useUserStore
}
from
'@/stores/user'
import
{
storeToRefs
}
from
'pinia'
import
type
{
Directive
}
from
'vue'
const
userStore
=
useUserStore
()
const
{
userInfo
}
=
storeToRefs
(
userStore
)
const
router
=
useRouter
()
...
...
@@ -148,4 +158,31 @@ const isHtml = computed(() => {
articleDetail
.
type
===
ArticleTypeEnum
.
INTERVIEW
)
})
const
showPreview
=
ref
(
false
)
const
currentPreviewIndex
=
ref
(
0
)
const
srcList
=
ref
<
string
[]
>
([])
// 图片预览的指令
const
vImagePreview
:
Directive
=
{
mounted
(
el
:
HTMLElement
)
{
const
imgs
=
el
.
querySelectorAll
(
'img'
)
imgs
.
forEach
((
item
,
index
)
=>
{
item
.
style
.
cursor
=
'pointer'
if
(
item
.
src
)
{
srcList
.
value
.
push
(
item
.
src
)
item
.
addEventListener
(
'click'
,
()
=>
{
currentPreviewIndex
.
value
=
index
showPreview
.
value
=
true
})
}
})
},
}
</
script
>
<
style
scoped
>
.html-content
{
font-size
:
18px
;
}
</
style
>
src/components/common/WangEditor/index.vue
View file @
387b0f7b
...
...
@@ -56,3 +56,9 @@ const handleCreated = (editor) => {
editorRef
.
value
=
editor
// 记录 editor 实例,重要!
}
</
script
>
<
style
scoped
>
/* 使用 :deep() 来穿透 scoped 样式的限制, 直接为编辑器内容区域设置样式。这里的 p 标签是内容的最小单位,为其设置样式最精确。 */
:deep
(
.w-e-text-container
p
)
{
font-size
:
18px
!important
;
}
</
style
>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment