小程序写的事件点击无反应,报错Component "pages/cgqsz/cgqsz" does not have a method "showPopup" to handle event "click".
wxml代码如下
<van-cell title="传感器类型" is-link bind:click="showPopup" value="恒压" arrow-direction="down"/>
<van-popup show="{{ show }}" bind:close="onClose">内容</van-popup>
js文件如下
```javascript
Page({
/**
* 页面的初始数据
*/
data: {
show: false,
},
showPopup() {
this.setData({ show: true });
},
onClose() {
this.setData({ show: false });
},
json中引用了相应的vant组件 "van-popup": "@vant/weapp/popup/index",
"van-cell": "@vant/weapp/cell/index",
"van-cell-group": "@vant/weapp/cell-group/index"