1.scroll-view组件
水平滚动使用方法:
(1) scroll-view的css需要设置white-space:nowrap;这个属性。还有需要设置scroll-x
(2) scroll-view的子集需要设置display:inline-block
垂直滚动使用方法:需要给scroll-view一个固定高度
通用说明:
(1) scroll-top,scroll-left是指定滚动条滚动到设置的位置,不带单位,就一个数值。
(2) scroll-left是水平滚动的时候用的,scroll-top是垂直滚动的时候用的。它们的值可以是动态的,也就是可以通过setData来动态设置数值。
(3) scroll-with-animation 是水平或者垂直滚动时的动画效果,如果没有这个属性,当设置scroll-top,scroll-left的值的时候,就是直接跳转到指定位置,并没有滑到指定位置的动画效果。
方法:在 app.json中设置tabar属性
"tabBar": {
"color": "#333",
"selectedColor": "#972524",
"backgroundColor": "#fff",
"list": [
{
"pagePath": "pages/index/index",
"iconPath": "/public/img/index/idx-k.png",
"selectedIconPath": "/public/img/index/idx-s.png",
"text": "首页"
},
{
"pagePath": "pages/examNewsIfo/examNewsIfo",
"iconPath": "/public/img/index/zx-k.png",
"selectedIconPath": "/public/img/index/zx-s.png",
"text": "招考资讯"
},
{
"pagePath": "pages/startCourseList/startCourseList",
"iconPath": "/public/img/index/kb-k.png",
"selectedIconPath": "/public/img/index/kb-s.png",
"text": "近期开班"
},
{
"pagePath": "pages/myCenter/myCenter",
"iconPath": "/public/img/index/my-k.png",
"selectedIconPath": "/public/img/index/my-s.png",
"text": "我的"
}]
}
(1) color 是未选中的颜色,selectedColor是选中的颜色,background是每个tab的背景色
(2) list是tab底部导航栏的信息,pagePath是页面路径,iconPath是未选中时的图标路径,selectedIconPath是选中时的图标路径,text是文字内容
(3) 如果有其它的 navigator 组件要跳转到tabBar所在的页面,需要设置 navigator 的 open-type=‘switchTab’
(4) 如果是通过api跳转的,则需要调用 wx.switchTab 这个api
(5) 可以动态设置tabBar的内容,具体的介绍 可看官网文档:界面------》设置tabBar
(6) taBar的图标大小是不能改的,如果想图片显示小一点,可以把图片的画布修改大一点,内容部分修改小一点就行了