$ cnpm install @uyun/ec-basic-layout
框架布局
作者:荣陶胜
删除产品中 Layout.init(产品编号)
代码,加入获取最新头部js代码代理
"proxy": [{
"context": ["/frontend/**"],
"target": "http://newprod.dev.cn",
"secure": false
}
若不添加代理或更新无法获取
window.USER_INFO_DATA
window.USER_INFO
window.UYUN_LANGUAGE
对象
使用BasicLayout组件
替换产品中布局组件
安装:
$ npm i --save @uyun/ec-basic-layout
使用:
import BasicLayout from '@uyun/ec-basic-layout'
export default class CMDBLayout extends Component {
render () {
return (
<BasicLayout
sideMenu={{ items: items, Link: Link }} /** 参考 @uyun/ec-side-menu API 配置 */
>
<div>
{ /** 产品主体内容 */}
</div>
</BasicLayout>
);
}
}
组件需要的代理环境:
"proxy": [{
"context": [
"/frontend/**" // newprod.dev.cn 环境是最新的 Layout-public.min.js
],
"target": "http://newprod.dev.cn",
"secure": false
}, {
"context": [
"/tenant/**", // 租户
"/notify/**", // 头部消息接口
"/portal/**" // 头部相关接口
],
"target": "本地测试环境",
"secure": false
}]
若不添加代理头部将无法获取数据
产品中出现以下场景:
使用了 window.location.href
或 location.href
修改成 window.UYUN_APPLICATION_SCREEN_VAR.location.href
例子
// 跳转到ant 产品
window.location.href = '/ant/history/executiveHistory'
// 修改成
window.UYUN_APPLICATION_SCREEN_VAR.location.href = '/ant/history/executiveHistory'
// 跳转到登录
window.location.href = '/tenant/#/login_admin/'
// 修改成
window.UYUN_APPLICATION_SCREEN_VAR.location.href = '/tenant/#/login_admin/'
window.UYUN_APPLICATION_SCREEN_VAR.location.href
是否可以正常运行使用经过 BasicLayout 包装的组件 Api
参数 | 说明 | 类型 | 默认值 |
---|---|---|---|
sideMenu | @uyun/ec-side-menu配置 或 () => <MySideMenu /> 。 不传表示没有侧边栏 |
object | func |
null |
children | 产品主体内容 | node | null |
productName | 产品名称 | string | null |
contentStyle | 产品主体内容style | string | null |
contentClassName | 产品主体内容className | object | null |
header | 提供给应用屏头部接口(产品中不需要配置) | BasicLayout.Header | null |
注意对 @uyun/ec-side-menu 进行二次封装的, render外层不容许再次包裹标签
class MySideMenu extends Component {
render () {
//return <div><SideMenu /></div> // 不容许再次嵌套
return <SideMenu />
}
}
BasicLayout.Header
参数 | 说明 | 类型 | 默认值 |
---|---|---|---|
changeSkin | 切换皮肤 | func | null |
goHome | 返回主页 | func | null |
data | 各个产品信息 | array | null |
grid | 布局 | array | null |
iconStyle | 产品名称与信息交换位置 | bool | null |
renderLink | 链接处理函数 | func | null |
嵌入应用屏
window.UYUN_APPLICATION_SCREEN_VAR
参数 | 说明 | 类型 |
---|---|---|
location.href | 获取地址, 跳转 | string |
isInApplicationScreen | 是否在应用屏中 | bool |
SUB_IFRAME_NAME | 窗口id, 一般就是产品名称。在应用屏的时候才会有 | string |
应用屏主要测试点
Copyright 2013 - present © cnpmjs.org