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
5051b4c6
Commit
5051b4c6
authored
Dec 02, 2025
by
lijiabin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【需求 17679】 feat: 完成评论 子评论相关内容
parent
45657088
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
148 additions
and
40 deletions
+148
-40
types.ts
src/api/article/types.ts
+5
-1
index.vue
src/components/common/Comment/index.vue
+126
-33
useScrollTop.tsx
src/hooks/useScrollTop.tsx
+17
-6
No files found.
src/api/article/types.ts
View file @
5051b4c6
...
...
@@ -256,7 +256,7 @@ export interface CommentSearchParams extends PageSearchParams {
* 获取子评论列表
*/
export
interface
CommentChildrenSearchParams
extends
PageSearchParams
{
p
I
d
:
number
|
string
p
i
d
:
number
|
string
articleId
:
number
|
string
}
...
...
@@ -293,4 +293,8 @@ export interface CommentItemDto {
userId
:
number
isHaveChildren
:
BooleanFlag
childrenNum
:
number
showChilderenPage
:
boolean
childrenPageCurrent
:
number
childrenPageList
:
CommentItemDto
[]
loadingChildren
:
boolean
}
src/components/common/Comment/index.vue
View file @
5051b4c6
This diff is collapsed.
Click to expand it.
src/hooks/useScrollTop.tsx
View file @
5051b4c6
...
...
@@ -19,16 +19,27 @@ function ScrollTopComp(_: any, { emit }: SetupContext<Events>) {
)
}
// 顺便兼容下多个的
export
const
useScrollTop
=
(
el
:
MaybeRef
<
HTMLElement
|
null
|
Window
>
,
el
:
MaybeRef
<
HTMLElement
|
null
|
Window
|
HTMLElement
[]
|
[
Window
]
>
,
options
:
{
compatFixedHeader
?:
boolean
}
=
{},
)
=>
{
const
{
compatFixedHeader
=
true
}
=
options
const
handleBackTop
=
()
=>
{
const
dom
=
unref
(
el
)
if
(
!
dom
)
return
const
handleBackTop
=
(
currentIndex
:
number
=
0
)
=>
{
const
initDoms
=
unref
(
el
)
if
(
!
initDoms
)
return
let
doms
=
[]
if
(
!
Array
.
isArray
(
initDoms
))
{
doms
=
[
initDoms
]
}
else
{
doms
=
initDoms
}
const
dom
=
doms
[
currentIndex
]
as
HTMLElement
|
Window
if
(
dom
instanceof
Window
)
{
window
.
scrollTo
({
top
:
0
,
...
...
@@ -38,13 +49,13 @@ export const useScrollTop = (
}
if
(
compatFixedHeader
)
{
const
top
=
dom
.
getBoundingClientRect
().
top
+
window
.
scrollY
-
52
const
top
=
dom
?.
getBoundingClientRect
?.
().
top
+
window
.
scrollY
-
52
window
.
scrollTo
({
top
,
behavior
:
'smooth'
,
})
}
else
{
dom
.
scrollIntoView
({
dom
?.
scrollIntoView
?.
({
behavior
:
'smooth'
,
block
:
'start'
,
})
...
...
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