Commit 5051b4c6 by lijiabin

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

parent 45657088
...@@ -256,7 +256,7 @@ export interface CommentSearchParams extends PageSearchParams { ...@@ -256,7 +256,7 @@ export interface CommentSearchParams extends PageSearchParams {
* 获取子评论列表 * 获取子评论列表
*/ */
export interface CommentChildrenSearchParams extends PageSearchParams { export interface CommentChildrenSearchParams extends PageSearchParams {
pId: number | string pid: number | string
articleId: number | string articleId: number | string
} }
...@@ -293,4 +293,8 @@ export interface CommentItemDto { ...@@ -293,4 +293,8 @@ export interface CommentItemDto {
userId: number userId: number
isHaveChildren: BooleanFlag isHaveChildren: BooleanFlag
childrenNum: number childrenNum: number
showChilderenPage: boolean
childrenPageCurrent: number
childrenPageList: CommentItemDto[]
loadingChildren: boolean
} }
...@@ -19,16 +19,27 @@ function ScrollTopComp(_: any, { emit }: SetupContext<Events>) { ...@@ -19,16 +19,27 @@ function ScrollTopComp(_: any, { emit }: SetupContext<Events>) {
) )
} }
// 顺便兼容下多个的
export const useScrollTop = ( export const useScrollTop = (
el: MaybeRef<HTMLElement | null | Window>, el: MaybeRef<HTMLElement | null | Window | HTMLElement[] | [Window]>,
options: { compatFixedHeader?: boolean } = {}, options: { compatFixedHeader?: boolean } = {},
) => { ) => {
const { compatFixedHeader = true } = options const { compatFixedHeader = true } = options
const handleBackTop = () => { const handleBackTop = (currentIndex: number = 0) => {
const dom = unref(el) const initDoms = unref(el)
if (!dom) return
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) { if (dom instanceof Window) {
window.scrollTo({ window.scrollTo({
top: 0, top: 0,
...@@ -38,13 +49,13 @@ export const useScrollTop = ( ...@@ -38,13 +49,13 @@ export const useScrollTop = (
} }
if (compatFixedHeader) { if (compatFixedHeader) {
const top = dom.getBoundingClientRect().top + window.scrollY - 52 const top = dom?.getBoundingClientRect?.().top + window.scrollY - 52
window.scrollTo({ window.scrollTo({
top, top,
behavior: 'smooth', behavior: 'smooth',
}) })
} else { } else {
dom.scrollIntoView({ dom?.scrollIntoView?.({
behavior: 'smooth', behavior: 'smooth',
block: 'start', 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