一、快手广告投放-配置 app.json
小程序根目录下的 app.json 文件用来对快手小程序进行全局配置。文件内容为一个 JSON 对象,有以下属性:
| 属性 | 类型 | 是否必填 | 描述 |
|---|---|---|---|
| pages | string[] | 是 | 页面路径列表 |
| window | object | 否 | 全局的默认窗口表现 |
| tabBar | object | 否 | 底部 tab 栏 |
pages
由一个数组组成,每一项都对应一个页面的路径(含文件名) 信息。文件名不需要写文件后缀,框架会自动解析 .json, .js, .ksml, .css 四个文件进行处理。 如果开发目录为:
├── app.js
├── app.json
├── app.css
├── pages
│ │── index
│ │ ├── index.ksml
│ │ ├── index.js
│ │ ├── index.json
│ │ └── index.css
│ └── logs
│ ├── logs.ksml
│ └── logs.js
└── utils
则需要在 app.json 中写
{
"pages": [
"pages/index/index",
"pages/logs/logs"
]}
window
快手推广用于设置小程序的状态栏、导航条、标题、窗口背景色
| 属性 | 类型 | 默认值 | 描述 |
|---|---|---|---|
| navigationBarBackgroundColor | HexColor | #ffffff | 导航栏背景颜色,如 #000000 |
| navigationBarTextStyle | String | black | 导航栏标题颜色,有效值 black / white |
| navigationBarTitleText | String | -- | 导航栏标题文字内容 |
| navigationStyle | String | default | 导航栏样式,有效值:default(默认样式) custom(自定义导航栏),只保留右上角胶囊按钮,在页面级配置优先级高于全局配置 |
| backgroundColor | HexColor | #ffffff | 窗口的背景色 |
| backgroundTextStyle | String | dark | 下拉 loading 的样式,有效值 dark / light |
| backgroundColorTop | string | #ffffff | 顶部窗口的背景色,仅 iOS 支持 |
| backgroundColorBottom | string | #ffffff | 底部窗口的背景色,仅 iOS 支持 |
| enablePullDownRefresh | Boolean | false | 是否全局开启下拉刷新。详见Page.onPullDownRefresh。 |
| onReachBottomDistance | Number | 50 | 页面上拉触底事件触发时距页面底部距离,单位为 px。详见Page.onReachBottom。 |
| pageOrientation | string | portrait | 屏幕旋转设置,支持 auto / portrait / landscape 详见 响应显示区域变化 |
快手广告代码数据案例
{
"window": {
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black",
"navigationBarTitleText": "快手接口功能演示",
"backgroundColor": "#eeeeee",
"backgroundTextStyle": "light"
}}
tabBar
用于设置客户端底部的 tab 栏:可通过 tabBar 设置 tab 的颜色、个数、位置、背景色等内容。
| 属性 | 类型 | 必填 | 默认值 | 描述 |
|---|---|---|---|---|
| color | HexColor | 是 | tab 上文字的默认颜色。 | |
| selectedColor | HexColor | 是 | tab 上的文字选中时的颜色。 | |
| backgroundColor | HexColor | 是 | tab 的背景色。 | |
| borderStyle | String | 否 | black | tabBar 边框颜色。有效值 black/white。 |
| list | Array | 是 | tab 的列表,详见 list 属性说明,最少 2 个、最多 5 个 tab | |
| position | string | 否 | bottom | tabBar 的位置,仅支持 bottom/top |
| custom | boolean | 否 | false | 自定义 tabBar, 见详情 |
其中 list 接受一个数组, tab 按数组的顺序排序, 属性之如下:
| 属性 | 类型 | 必填 | 说明 |
|---|---|---|---|
| pagePath | string | 是 | 页面路径,必须在 pages 中先定义 |
| text | string | 是 | tab 上按钮文字 |
| iconPath | string | 否 | 图片路径,icon 大小限制为 40kb,建议尺寸为 81px * 81px,不支持网络图片。 当 position 为 top 时,不显示 icon。 |
| selectedIconPath | string | 否 | 选中时的图片路径,icon 大小限制为 40kb,建议尺寸为 81px * 81px,不支持网络图片。 当 position 为 top 时,不显示 icon。 |

评论列表