Commit 5051b4c6 by lijiabin

【需求 17679】 feat: 完成评论 子评论相关内容

parent 45657088
......@@ -256,7 +256,7 @@ export interface CommentSearchParams extends PageSearchParams {
* 获取子评论列表
*/
export interface CommentChildrenSearchParams extends PageSearchParams {
pId: number | string
pid: 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
}
......@@ -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',
})
......
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