1***@qq.com
1***@qq.com
  • 发布:2020-07-26 00:42
  • 更新:2022-07-17 15:05
  • 阅读:6381

Component "pages/index/shouquan" does not have a method "tap" to handle event "tap"

分类:uni-app

编译到微信小程序,总是提示这个,Component "pages/index/shouquan" does not have a method "tap" to handle event "tap"
以下是代码:
<template>
<view>
<rich-text :nodes="nodes" bindtap="tap"></rich-text>
</view>
</template>

<script>
export default {
data() {
return {
nodes: [
{
name: 'div',
attrs: {
class: 'div_class',
style: 'line-height: 60px; color: red;'
},
children: [
{
type: 'text',
text: 'Hello World!'
},
{
name:"img",
attrs: {
style: 'width: 100px;',
src:'http://photocdn.sohu.com/20120910/Img352705474.jpg'
},
}
]
},
]
}
},
methods: {
tap() {
console.log('tap')
}
}
}
</script>

<style>

</style>

转到微信小程序后,运行点击就会出现上面的提示。

2020-07-26 00:42 负责人:无 分享
已邀请:
厉白竹

厉白竹

有的时候不能用bind绑定事件,不然编译到小程序就报这个错,但是用@就可以。

1***@qq.com

1***@qq.com (作者)

上传个附件,

该问题目前已经被锁定, 无法添加新回复

  • 标题 / 粗斜体
  • 代码片段
  • 超链接 / 图片 / 视频
  • 列表 / 引用

文章内容较多时,可以用标题分段 :

## 大标题 
### 小标题

斜体 / 粗体 :

**粗体** 
*斜体*
***粗斜体***

代码片段 :

``` javascript
代码片段
```

超链接 :

[链接文字](链接地址) 例: [百度](http://www.baidu.com)

图片 :

![图片说明](图片地址) 例: ![百度logo](http://www.baidu.com/img/bdlogo.gif)

视频 :

!![视频说明](视频地址) 例: !![优酷视频](http://youku.com)

有序列表 :

1. 123
2. 123
3. 123

无序列表 :

- 123
- 123
- 123

引用 : ( 双回车后结束引用 )

> 引用内容
引用内容
引用内容