html - Vue js,属性或方法“showExplaination”未在实例上定义,但在渲染期间引用
问题描述
我正在尝试使用 Vue js 做一个网站,但我遇到了 @click 问题,找不到函数 showExplaination()。
我有以下错误: [Vue 警告]:属性或方法“showExplaination”未在实例上定义,但在渲染期间被引用。通过初始化该属性,确保该属性是反应性的,无论是在数据选项中,还是对于基于类的组件。
<div class="vue">
<button class="btn btn-danger" @click="showExplaination">
Show explaination
</button>
<div v-show="explaination">Explaination</div>
</div>
这是javascript代码
var app = new Vue({
el: '.vue',
data: {
explaination: false
},
method: {
showExplaination: function() {
this.explaination = !this.explaination;
}
}
});
谢谢你的帮助
解决方案
推荐阅读
- reactjs - 想要在点击 reactjs 时选择缩略图
- python - 将多个图像复制到剪贴板
- google-colaboratory - Google Colab TypeError:需要一个整数(获取类型 str)
- r - 用于常规读取数据的闪亮模块(不是由新会话触发
- firebase - FLutter:无法完成从 Firestore 中检索数据
- android - 尝试更改另一个片段上的文本视图
- python - 遮罩多边形和精灵之间的碰撞
- python - 数据框从值中获取索引日期
- c# - 运算符“*”不能应用于“void”和“float”类型的操作数
- javascript - 未处理的拒绝(TypeError):net.isIPv4 不是 ReactJS 的函数