代码演示

基本形式

<div class="demo-main">
<div class="demo-head">
<img src="//haitao.nos.netease.com/2fecfadc7d48464b90c2fe9b5d92412a.svg" width="34px" height="34px" style="margin-right:9px;" />
NEKUI系统
</div>
<ui.sidebar menus={menus} bodyEl="j-body" />
<div id="j-body" class="demo-body">
<ui.card title="标题">
content
</ui.card>
</div>
</div>

var component = new NEKUI.Component({
template: template,
data: {
menus: [{
title: '一级菜单A',
open: true,
children: [{
title: '二级菜单A',
url: '/'
},{
title: '二级菜单B',
url: '/'
}]
}, {
title: '一级菜单B',
children: [{
title: '二级菜单A',
url: '/'
},{
title: '二级菜单B',
url: '/'
}]
}]
}
});

API

Classes

Sidebar

Functions

config()

Kind: global class
Extend: Component

new Sidebar()

Param Type Default Description
[options.data] object = 绑定属性
[options.data.class] string => 补充class
[options.data.menus] array => 菜单数组
[options.data.top] string "'60px'" => 菜单style top的值
[options.data.active] boolean true => 默认是否收起
[options.data.bodyEl] string "''" => 主内容区body元素的id,当菜单收起时,拉伸bodyEl
[options.data.uniqueOpened] boolean true => 是否只保持打开一个菜单
[options.data.titleKey] string "title" => 一级菜单的字段key名
[options.data.urlKey] string "\"url\"" => 菜单结构中的链接key名
[options.data.pageKey] string "\"title\"" => 二级菜单的字段key名
[options.data.childrenKey] string "\"children\"" => 一级菜单对象下二级菜单数组的key名

config()

Kind: global function
Access: protected