1. 在index.js文件的data中声明参数,这里以动态更换顶部背景颜色为例。 2. 在index.wxml文件中引用该参数,这里用到了vant-webapp的组件。 3. 在index.js中写滚动触发的函数事件