When attempting to extract a variable from a method, I encounter the following error message:
Property 'commentLikeVisible' does not exist on type '{ toggleCommentLikeVisible: () => void;
This is the code I am working with:
<template>
<div
class="moments-item"
data-index="0"
>
<div class="item-right">
<div class="item-ft">
<div
class="item-reply-btn"
@click="toggleCommentLikeVisible"
>
<span class="item-reply" />
</div>
<CommentLikeModal
v-if="commentLikeVisible"
/>
</div>
</div>
</div>
</template>
<script lang="ts"&quo t>
import CommentLikeModal from '@/components/CommentLikeModal.vue';
export default {
name: 'MomentItem',
components: {
CommentLikeModal
},
data() {
return {
commentLikeVisible: false
}
},
methods: {
toggleCommentLikeVisible: function() {
this.commentLikeVisible = !this.commentLikeVisible;
}
}
}
</script>
I have attempted using toggleCommentLikeVisible()
in place of
toggleCommentLikeVisible: function()
but encountered the same issue. Any insight into what may be causing this problem would be greatly appreciated.