# PortalAPI
# 1.简介
门户中主要api
# window.PortalAPI.env
环境变量,能获取到url上的参数、移动端能获取到getParam
中的参数。
env中的包含的主要参数 | 参数 | 说明 | 类型 | 示例 | 备注 |
---|---|---|---|---|---|
configId | 配置文件id | String | — | — | |
bizId | 业务包id | String | — | — | |
platform | 平台 | String | — | — | |
debug | debug模式是否打开 | String | true | — | |
spaceId | 异常回调函数 | String | — | — |
# window.PortalAPI.getElementData(bizId, configId, params, callback)
根据栏目元素
获取单个元素
的数据。
参数 | 说明 | 类型 | 示例 | 备注 |
---|---|---|---|---|
bizId | 配置文件id | String | — | — |
configId | 业务包id | String | — | — |
params | 条件参数 | Object | {id:栏目元素id,platform:1} | platform[1:pc][2:移动] |
callback | 回调 | String | true | — |
# window.PortalAPI.getColumnData(bizId, configId, params, callback)
根据栏目元素
获取单个元素
的数据。
参数 | 说明 | 类型 | 示例 | 备注 |
---|---|---|---|---|
bizId | 配置文件id | String | — | — |
configId | 业务包id | String | — | — |
params | 条件参数 | Object | {id:栏目id,platform:1} | platform[1:pc][2:移动] |
callback | 回调 | String | true | — |
# window.PortalAPI.getThemeAttribute(className, Attr, tag)
js获取皮肤中的
参数 | 说明 | 类型 | 示例 | 备注 |
---|---|---|---|---|
className | 皮肤中的class名称 | String | — | — |
Attr | 业务包id | String | — | — |
tag | 业务包id | String | — | — |
.cap-link {
color: #BBBBBA;
}
.cap-link:hover {
color: red;
}
var color1 = window.PortalAPI.getThemeAttribute('cap-link', 'color')
var color2 = window.PortalAPI.getThemeAttribute('cap-link', 'color', 'hover')
// color1:#BBBBBA
// color2:red
# window.PortalAPI.getColor20ByNum(num)
// 获取皮肤中20个颜色,num从1开始。
num如果超出20 则循环获取,比如num=21与num=1 是一样的值。
# window.PortalAPI.getSeeyonPath(platform)
pc 会获取到 '/seeyon'
移动返回的是:window.cmp.util.getSeeyonPath()
# window.PortalAPI.columnJumpContent(params)
// 查询列表跳转。
/** 获取内容url
* params: {
* bizId, // 业务包id
* configId, // 配置id
* columnId, // 栏目id
* elementId, // 元素id
* platform, // 类型,'1'为PC,'2'为移动
* op, // 操作
* q, // 描述
* }
**/
# window.PortalAPI.isPreview()
是否是预览态
# window.PortalAPI.isEdit()
是否是编辑态
# window.PortalAPI.menuJumpContent(params)
跳转穿透 params 为菜单或者快捷入口 后端返回的数据。
# window.PortalAPI.getUrlParams(name)
从url上获取参数。
# window.PortalAPI.getPlugin(name,callback)
现在只能获取echarts对象,使用这个方法可以无需在栏目中引入大型的插件对象,优化栏目的体积。
window.PortalAPI.getPlugin('echarts' ,function(echarts){
// 返回echarts对象
});
编撰人:yinyanting
快速跳转
- PortalAPI
- 1.简介
- window.PortalAPI.env
- window.PortalAPI.getElementData(bizId, configId, params, callback)
- window.PortalAPI.getColumnData(bizId, configId, params, callback)
- window.PortalAPI.getThemeAttribute(className, Attr, tag)
- window.PortalAPI.getColor20ByNum(num)
- window.PortalAPI.getSeeyonPath(platform)
- window.PortalAPI.columnJumpContent(params)
- window.PortalAPI.isPreview()
- window.PortalAPI.isEdit()
- window.PortalAPI.menuJumpContent(params)
- window.PortalAPI.getUrlParams(name)
- window.PortalAPI.getPlugin(name,callback)
- 1.简介
