赞
踩
@import
样式导入@import
语法,可以导入外联的样式表@import
后跟需要导入的外联样式表的相对路径,用;表示语句结束/* common样式 */
.username {
color: red;
}
/* 导入样式 */
@import "/common/common.wxss";
app.wxss
中的样式为全局样式,作用于每一个页面.wxss
文件中定义的样式为局部样式,只作用于当前页面app.json
文件是小程序的全局配置文件。常用的配置项如下:
pages
window
tabBar
style
"window":{
"navigationBarBackgroundColor": "#025D54",
"navigationBarTitleText": "在线测试",
"navigationBarTextStyle":"white",
"enablePullDownRefresh": true,
"backgroundColor": "#efefef",
"backgroundTextStyle":"dark",
"onReachBottomDistance": 50
},
属性名 | 类型 | 默认值 | 说明 |
---|---|---|---|
navigationBarTitleText | String | 字符串 | 导航栏标题文字内容 |
navigationBarBackgroundColor | HexColor | #000000 | 导航栏背景颜色,如#000000 |
navigationBarTextStyle | String | white | 导航栏标题颜色,仅支持black / white |
backgroundColor | HexColor | f#fffff | 窗口的背景色 |
backgroundTextStyle | String | dark | 下拉loading的样式,仅支持dark / light |
enablePullDowntRefresh | Boolean | false | 是否全局开启下拉刷新 |
onReachBottomDistance | Number | 50 | 页面上拉触底事件触发时距页面底部距离,单位为px |
app.json
->window
app.json
->window
->enablePullDownRefresh
设置为true
app.json
开启下拉刷新功能后,会作用于每个小程序页面app.json
->window
->backgroundColor
16进制颜色值(#efefef
)app.json
->window
->backgroundTextStyle
为dark
backgroundTextStyle
可选值只有dark
和light
通过手指在屏幕上的上拉滑动操作,从而加载更多数据的行为。
设置路径:app.json
->window
->onReachBottomDistance
设置新的值
注意:默认距离为50px,如果没有特殊需求,建议使用默认值
backgroundColor
:tabBar 的背景色selectedlconPath
:选中时的图片路径borderStyle
:tabBar上边框的颜色iconPath
:未选中时的图片路径selectedColor
: tab上的文字选中时的颜色color
:tab上文字的默认(未选中)颜色属性 | 类型 | 必填 | 默认值 | 描述 |
---|---|---|---|---|
list | Array | 是 | tab页签的列表,最少2个,最多5个 | |
positon | String | 否 | bottom | tabBar的位置,仅支持bottom/top |
borderStyle | String | 否 | black | tabBar上边框的颜色,仅支持black/white |
color | HexColor | 否 | tab上文字的默认(未选中)颜色 | |
selectedColor | HexColor | 否 | tab上的文字选中时的颜色 | |
backgroundColor | HexColor | 否 | tabBar的背景色 |
属性 | 类型 | 必填 | 描述 |
---|---|---|---|
pagePath | String | 是 | 页面路径,页面必须在pages中预先定义 |
text | String | 是 | tab上显示的文字 |
iconPath | String | 否 | 未选中时的图标路径;当postion为top时,不显示icon |
selectedIconPath | String | 否 | 选中时的图标路径;当postion 为top时,不显示icon |
"tabBar": { "list": [ { "pagePath": "pages/home/home", "text": "home", "iconPath": "images/home.png", "selectedIconPath": "images/home-active.png" }, { "pagePath": "pages/message/message", "text": "message", "iconPath": "images/message.png", "selectedIconPath": "images/message-active.png" }, { "pagePath": "pages/contact/contact", "text": "contact", "iconPath": "images/contact.png", "selectedIconPath": "images/contact-active.png" } ] }
.json
配置问价你,用来对当前页面的窗口外观、页面效果等进行配置。app.json
中的window
节点,可以全局配置小程序中每个页面的窗口表现。.json
配置文件”就可以实现这种需求。属性 | 类型 | 默认值 | 描述 |
---|---|---|---|
navigationBarBackgroundColor | HexColor | #000000 | 当前页面导航栏背景颜色,如#000000 |
navigationBarTextStyle | String | white | 当前页面导航栏标题颜色,仅支持black / white |
navigationBarTitleText | String | 当前页面导航栏标题文字内容 | |
backgroundColor | HexColor | #ffffff | 当前页面窗口的背景色 |
backgroundTextStyle | String | dark | 当前页面下拉loading的样式,仅支持dark / light |
enablePullDownRefresh | Boolean | false | 是否为当前页面开启下拉刷新的效果 |
onReachBottomDistance | Number | 50 | 页面上拉触底事件触发时距页面底部距离,单位为px |
enablePullDownRefresh
:一般全局不开启,在特定有需求的页面开启Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。