dcloudio / dcloudio/uni-app

父组件向子组件传递方法时,在H5和微信开发者工具中this指向不一致

Open
#2,142 0 comments 0 reactions 0 assignees View on GitHub
mp-weixin 不明确复现步骤、未提供复现工程
Dominant language
JavaScript
Stars
41.6k
Forks
3.7k
Avg merge
7h 6m
Merged PRs (30d)
6

Description

**问题描述**
父组件向子组件传递方法时,在H5和微信开发者工具中this指向不一致

父组件:
![image](https://user-images.githubusercontent.com/54974019/94113162-0e249d80-fe79-11ea-84c8-7f8be49817ad.png)
![image](https://user-images.githubusercontent.com/54974019/94113209-1c72b980-fe79-11ea-95d8-19d75453067d.png)

子组件:
![image](https://user-images.githubusercontent.com/54974019/94113125-fd742780-fe78-11ea-8707-f4bb1279151f.png)

在**H5**中,打印出的this指向父组件
在**微信开发者工具**中,this指向子组件

**补充信息**
可能针对不同平台uni编译出的代码,对this的绑定不一致

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.