| | |
| | | </view> |
| | | </view> |
| | | <view class="comment-opeartor"> |
| | | <up-icon name="heart" size="30rpx" /> |
| | | <up-icon |
| | | name="heart" |
| | | size="30rpx" |
| | | :color="isLiked ? '#FF0000' : '#B9B9B9'" |
| | | @click="handleLike(props.id)" |
| | | /> |
| | | <view class="comment-opeartor-heart-number">{{ likes }}</view> |
| | | </view> |
| | | </view> |
| | |
| | | <view class="sub-comment"> |
| | | <comment-sub-item |
| | | v-for="(item, index) in child" |
| | | :key="index" |
| | | :avatar="item.picture" |
| | | :nickname="item.commentUserName" |
| | | :isAuthor="item.createBy === filmInfo.createBy" |
| | |
| | | :date="item.createTime" |
| | | address="湖北" |
| | | :likes="item.likeCount" |
| | | @reply="emitReply" |
| | | :isLiked="item.isLike" |
| | | :id="item.id" |
| | | @reply="handleSubReply" |
| | | @like="handleLike" |
| | | :filmInfo="filmInfo" |
| | | /> |
| | | </view> |
| | |
| | | likes: number |
| | | child: CommentDTO[] |
| | | filmInfo: CommentDTO |
| | | isLiked: boolean |
| | | id: number |
| | | } |
| | | |
| | | const props = defineProps<Props>() |
| | | |
| | | const emit = defineEmits<{ |
| | | (e: 'reply'): void |
| | | (e: 'reply', id?: number): void |
| | | (e: 'like', id: number): void |
| | | }>() |
| | | |
| | | |
| | |
| | | |
| | | |
| | | const onReply = () => { |
| | | emit('reply') |
| | | emit('reply', props.id) // ✅ 传递父评论ID |
| | | } |
| | | |
| | | const emitReply = () => { |
| | | emit('reply') |
| | | const handleSubReply = (commentId: number) => { |
| | | console.log("commentId",commentId) |
| | | emit('reply', commentId) |
| | | } |
| | | |
| | | const handleLike = (commentId: number) => { |
| | | console.log('handleLike', commentId) |
| | | emit('like', commentId) |
| | | } |
| | | </script> |
| | | |