无法从Vue.js(带Ionic)中的方法访问数据



我试图从一个方法访问一个变量,但我得到:Property 'commentLikeVisible' does not exist on type '{ toggleCommentLikeVisible: () => void;

这是我的代码:

<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">
import CommentLikeModal from '@/components/CommentLikeModal.vue';
export default {
name: 'MomentItem',
components: {
CommentLikeModal
},
data() {
return {
commentLikeVisible: false
}
},
methods: {
toggleCommentLikeVisible: function() {
this.commentLikeVisible = !this.commentLikeVisible;
}
}
}
</script>

我已经尝试过toggleCommentLikeVisible()而不是CCD_ 3具有相同的结果。

我不知道里面可能出了什么问题。

我认为这是一个警告/错误,因为您有<script lang="ts">。如果您编辑脚本标记,它似乎会在我创建的<script>示例项目中消失

最新更新