From c31a8def0ac90d86b8e8e345441bd28002a9ef2f Mon Sep 17 00:00:00 2001
From: cloudroam <cloudroam>
Date: 星期一, 16 六月 2025 20:14:52 +0800
Subject: [PATCH] add: 分享

---
 components/comment/comment-sub-item.vue |   24 +++++++++++++++++++-----
 1 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/components/comment/comment-sub-item.vue b/components/comment/comment-sub-item.vue
index 22f6188..e36c47d 100644
--- a/components/comment/comment-sub-item.vue
+++ b/components/comment/comment-sub-item.vue
@@ -19,7 +19,12 @@
           </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>
@@ -28,8 +33,7 @@
 </template>
 
 <script setup lang="ts">
-import { defineProps, defineEmits } from 'vue'
-
+import { CommentDTO } from '@/types/index'
 const props = defineProps<{
   avatar: string
   nickname: string
@@ -39,14 +43,24 @@
   date: string
   address: string
   likes: number
+  filmInfo: CommentDTO
+  isLiked: boolean
+  id: number
 }>()
 
 const emit = defineEmits<{
-  (e: 'reply'): void
+  (e: 'reply', id: number): void
+  (e: 'like', id: number): void
 }>()
 
 const onReply = () => {
-  emit('reply')
+  console.log("onReply",props)
+  emit('reply', props.id)
+}
+
+const handleLike = (id: number) => {  // 添加参数
+  console.log("handleLike", id)
+  emit('like', id)
 }
 </script>
 

--
Gitblit v1.9.3