daijian_wd

fix: 解决收藏bug

... ... @@ -41,7 +41,7 @@ const TAG = 'OperRowListView';
@Preview
@Component
export struct OperRowListView {
@Prop contentDetailData: ContentDetailDTO // 稿件详情
@Prop @Watch('onDetailUpdated') contentDetailData: ContentDetailDTO // 稿件详情
@State operationButtonList: string[] = ['comment', 'collect', 'share'] // 组件展示条件
@ObjectLink publishCommentModel: publishCommentModel
// @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
... ... @@ -52,7 +52,9 @@ export struct OperRowListView {
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
needLike: boolean = true
async aboutToAppear() {
// async aboutToAppear() {
async onDetailUpdated() {
if (!this.contentDetailData) return
const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
if (user_id) {
this.getInteractDataStatus()
... ... @@ -99,20 +101,22 @@ export struct OperRowListView {
})
.width(42)
ForEach(this.operationButtonList, (item: string, index: number) => {
if (item == 'comment') {
this.builderComment()
} else if (item == 'like' && this.needLike) {
this.builderLike()
} else if (item == 'collect') {
this.builderCollect()
} else if (item == 'listen') {
this.builderListen()
} else if (item == 'share') {
this.builderShare()
} else {
}
})
if (this.contentDetailData) {
ForEach(this.operationButtonList, (item: string, index: number) => {
if (item == 'comment') {
this.builderComment()
} else if (item == 'like' && this.needLike) {
this.builderLike()
} else if (item == 'collect') {
this.builderCollect()
} else if (item == 'listen') {
this.builderListen()
} else if (item == 'share') {
this.builderShare()
} else {
}
})
}
}
.width('100%')
.justifyContent(FlexAlign.Start)
... ...