Sheldon Law
Sheldon Law
## 需求描述 从小程序基础库版本 1.6.3 开始,小程序支持简洁的组件化编程 - [小程序自定义组件](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/),但在Component中引用weSwiper会出现动画失效的问题。 ### 通过阅读源码发现: weSwiper通过动态修改view中的animation属性来实现动画效果,数据传递是通过page.setData来实现的。这样就导致了在Component里引用weSwiper时,无法得到更新的animation值来实现动画。  ## 具体实现 为了实现在Component中引用weSwiper,添加了context参数,使得数据传递是通过context.setData(这里的context是component)来实现的,具体代码如下:  ## 讨论 还有没有别方案实现该需求:通过page.setData来改变page的animation属性,再将page中的animation属性传递给component,实现动画。但是破坏了component的封装性。 欢迎讨论,再次感谢你们贡献了这个优秀的组件!
**Thanks for building such a timesaving tool.** When I try to add this amazing tool into my project to implement live reload, I got an Error with config by default....