Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
douaojie
2024-05-11 11:06:50 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
347fc0aa3697352d0bea1fc2c65931e747b7a3ea
347fc0aa
1 parent
e1928b87
fix: 评论添加缺省图
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
8 deletions
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/CommentComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/CommentComponent.ets
View file @
347fc0a
...
...
@@ -6,6 +6,7 @@ import { CommentCustomDialog } from './CommentCustomDialog';
import { publishCommentModel } from '../model/PublishCommentModel';
import { HttpUtils } from 'wdNetwork/Index';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import NoMoreLayout from '../../page/NoMoreLayout';
import { EmptyComponent } from '../../view/EmptyComponent';
const TAG = 'CommentComponent';
...
...
@@ -18,7 +19,7 @@ const testString = '因为读书的人\n是低着头向上看的人\n身处一
export struct CommentComponent {
@State hasMore: boolean = true;
@State currentPage: number = 1;
// @State private browSingModel: commentListModel = new commentListModel()
@State isComments: boolean = true
/*必传*/
@ObjectLink publishCommentModel: publishCommentModel
listScroller: ListScroller = new ListScroller(); // scroller控制器
...
...
@@ -27,6 +28,8 @@ export struct CommentComponent {
@State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource();
@State dialogController: CustomDialogController | null = null;
// @State private browSingModel: commentListModel = new commentListModel()
// 在自定义组件即将析构销毁时将dialogControlle置空
aboutToDisappear() {
this.dialogController = null // 将dialogController置空
...
...
@@ -137,9 +140,16 @@ export struct CommentComponent {
List({ scroller: this.listScroller }) {
ListItemGroup({ header: this.titleHeader() })
if (!this.isComments) {
EmptyComponent({ emptyType: 17 })
.height(300)
} else {
LazyForEach(this.allDatas, (item: commentItemModel, index: number) => {
if (item.hasMore) {
ListItemGroup({ header: this.CommentHeaderItem(item, index), footer: this.GroupFooterView(item, index) }) {
ListItemGroup({
header: this.CommentHeaderItem(item, index),
footer: this.GroupFooterView(item, index)
}) {
LazyForEach(item.childCommentsLazyDataSource, (childItem: commentItemModel, subIndex: number) => {
ListItem() {
ChildCommentItem({
...
...
@@ -174,18 +184,16 @@ export struct CommentComponent {
// 加载更多
ListItem() {
if (this.hasMore === false) {
// NoMoreLayout()
EmptyComponent({ emptyType: 17 })
.height(300)
NoMoreLayout()
}
}
}
}
.onReachEnd(() => {
if (this.hasMore) {
this.getData()
}
})
.enableScrollInteraction(false)
}
...
...
@@ -204,6 +212,10 @@ export struct CommentComponent {
this.publishCommentModel.totalCommentNumer = commentListModel.totalCommentNum + ''
}
if (commentListModel.list.length === 0) {
this.isComments = false
}
if (commentListModel.hasNext === 0) {
this.hasMore = false;
} else {
...
...
@@ -226,7 +238,6 @@ export struct CommentComponent {
this.hasMore = false
}
})
}
}
...
...
Please
register
or
login
to post a comment