cloudroam
2025-06-13 a4892378960434c17bb20f19e537df54be598142
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,6 +33,7 @@
</template>
<script setup lang="ts">
import { CommentDTO } from '@/types/index'
const props = defineProps<{
  avatar: string
  nickname: string
@@ -37,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>