小程序·使用echarts不跟随父元素滑动的问题

微信echarts文档链接:https://github.com/ecomfe/echarts-for-weixin

echarts官方文档:https://echarts.apache.org/zh/index.html

刚添加echarts的时候:

 

 

 滚动页面的时候:

 

 

1. 当时百度了很多办法有大神说是因为echarts的默认触碰值的问题

bindtouchstart="touchStart"

bindtouchmove="touchMove"

bindtouchend="touchEnd" 

去掉这几个默认的方法就行了 但是在我这并不适用

2.使用disable-scroll="true"

在界面的遮罩层添加disable-scroll="true" 在我这也不适用

3.查看canvas的层级是否使用了height="100%",position定位 只要是canvas的父级元素都不能添加

检查元素发现没有使用这些样式 最后发现在page上设置了height="100%" 这个需要注意下

小程序的echarts用的是canvas所以层级最高 使用z-index无效,所以需要覆盖echarts需要使用cover-view或cover-image;

查找的相关文章:https://blog.csdn.net/xd_yangxiaoromg/article/details/88258744?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-2.nonecase&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-2.nonecase

 

posted @ 2020-06-10 11:56  菜鸟婷婷  阅读(2268)  评论(0编辑  收藏  举报