详细问题描述
(DCloud产品不会有明显的bug,所以你遇到的问题大都是在特定环境下才能重现的问题,请仔细描述你的环境和重现方式,否则DCloud很难排查解决你的问题)
[内容]"nvueCompiler":"uni-app"模式下,subNVue的touch事件无法获取详情信息; 而"nvueCompiler":"week"模式下则正常
重现步骤
[步骤]在"uni-app"模式下,任意写一个subNVue原生子窗体,并让其被任意vue页面调用。此时,在subNVue中监听touchstart、touchmove、touchend等事件,获取其event,用console.log打印,发现event的详情信息中,除了timeStamp有效,其余信息皆为空。如果改为"week"编译模式,则event可得到全部信息。
[结果]
"uni-app"模式下,console.log(JSON.stringify(event));的结果:
{"type":"touchstart","timeStamp":1568133356644,"target":{"id":"","dataset":{},"offsetLeft":0,"offsetTop":0},"currentTarget":{"id":"","dataset":{},"offsetLeft":0,"offsetTop":0},"detail":{},"touches":[],"changedTouches":[]}
"week"模式下,console.log(JSON.stringify(event));的结果:
{"changedTouches":[{"screenY":1338.1944580078125,"screenX":361.1111145019531,"pageX":33.33333206176758,"pageY":49.30555725097656,"identifier":0}],"type":"touchstart","target":{"ref":"488","type":"view","attr":{},"style":{"flexDirection":"column","justifyContent":"space-between","width":92,"height":92,"marginTop":4,"marginRight":4,"marginBottom":4,"marginLeft":4,"borderWidth":1,"borderColor":"#D0D0D0","borderRadius":8,"backgroundImage":"linear-gradient();"},"event":["touchstart","touchmove","touchend","touchcancel"]},"currentTarget":{"ref":"488","type":"view","attr":{},"style":{"flexDirection":"column","justifyContent":"space-between","width":92,"height":92,"marginTop":4,"marginRight":4,"marginBottom":4,"marginLeft":4,"borderWidth":1,"borderColor":"#D0D0D0","borderRadius":8,"backgroundImage":"linear-gradient();"},"event":["touchstart","touchmove","touchend","touchcancel"]},"timestamp":1568132603338}
[期望]希望在“uni-app”模式下,也能获得正确的event。
[如果语言难以表述清晰,拍一个视频或截图,有图有真相]
IDE运行环境说明
[HBuilder 或 HBuilderX。如果你用其他工具开发uni-app,也需要在此说明] HBuilderX
[IDE版本号]2.2.2.20190816
[windows版本号]windows 10 家庭中文版
[mac版本号]
uni-app运行环境说明
[运行端是h5或app或某个小程序?]APP
[运行端版本号]
[项目是cli创建的还是HBuilderX创建的?如果是cli创建的,请更新到最新版cli再试]
[编译模式是老模板模式还是新的自定义组件模式?]自定义组件模式
App运行环境说明
[Android版本号]9
[iOS版本号]
[手机型号]小米MIX 2
[模拟器型号]
附件
[IDE问题请提供HBuilderX运行日志。菜单帮助-查看运行日志,点右键打开文件所在目录,将log文件压缩成zip包上传]
[App问题请提供可重现问题的代码片段,你补充的细一点,问题就解决的快一点]
[App安装包或H5地址]
[可重现代码片段]
联系方式
[QQ]867465516
0 个回复