代码演示
基本形式
<div class=g-row><ui.button type="primary" title="primary" /><ui.button type="secondary" title="secondary" /><ui.button type="tertiary" title="tertiary" /><ui.button type="info" title="info" /><ui.button type="success" title="success" /><ui.button type="warning" title="warn" /><ui.button type="error" title="error" /></div><div class=g-row><ui.button type="primary" title="primary" size="sm" /><ui.button type="secondary" title="secondary" size="sm" /><ui.button type="tertiary" title="tertiary" size="sm" /><ui.button type="info" title="info" size="sm" /><ui.button type="success" title="success" size="sm" /><ui.button type="warning" title="warn" size="sm" /><ui.button type="error" title="error" size="sm" /></div>
var component = new NEKUI.Component({template: template});
常用的button类型
<div class=g-row><ui.button action="view" title="查看" /><ui.button action="undo" title="撤销" /><ui.button action="cancel" title="取消" /><ui.button action="remove" title="删除" /><ui.button action="update" title="更新" /></div><div class=g-row><ui.button action="submit" title="提交" /><ui.button action="save" title="保存" /><ui.button action="copy" title="复制" /><ui.button action="pass" title="通过" /><ui.button action="reject" title="驳回" /></div><div class=g-row><ui.button action="backward" title="返回" /><ui.button action="download" title="下载" /><ui.button action="upload" title="上传" /><ui.button action="search" title="查询" /><ui.button action="edit" title="编辑" /></div><div class=g-row><ui.button action="add" title="添加" /><ui.button action="link" title="链接" link="http://www.baidu.com" /></div>
圆角的图标按钮
<div class=g-row><ui.button action="update" shape="circle" size="xs" /><ui.button action="update" shape="circle" size="sm" /><ui.button action="update" shape="circle" /><ui.button action="update" shape="circle" size="lg" /><ui.button action="update" shape="circle" size="xl" /></div>
图标按钮
<div class=g-row><ui.button action="update" type="primary" shape="icon" size="xs" /><ui.button action="update" type="info" shape="icon" size="sm" /><ui.button action="update" type="error" shape="icon" /><ui.button action="update" shape="icon" size="lg" /><ui.button action="update" shape="icon" size="xl" /></div>
加载中的按钮
<div class=g-row><ui.button action="update" loading /></div>
buttonGroup
<div class=g-row><div class="u-btngroup u-btngroup-horizontal"><ui.button action="view" /><ui.button action="edit" /></div></div>
API
Input
Kind: global classExtend: Component
new Input()
Param | Type | Default | Description |
---|---|---|---|
[options.data] | object | = 绑定属性 | |
[options.data.title] | string | "确定" | => 按钮标题 |
[options.data.type] | string | "default" | => 按钮样式, primary, default, info, success, warn, error |
[options.data.size] | string | "normal" | => 按钮大小, xs, sm, lg, xl |
[options.data.icon] | string | => 按钮图标,action不能满足需求时使用; | |
[options.data.action] | string | => 按钮操作类型, 每种类型有对应的icon; | |
[options.data.link] | string | => 按钮的链接 | |
[options.data.target] | string | "_self" | => 按钮链接的打开方式 |
[options.data.shape] | string | => circle, icon或者默认 | |
[options.data.download] | string | => 下载链接 | |
[options.data.loading] | boolean | false | => 是否正在加载 |
[options.data.disabled] | boolean | false | => 禁止按钮 |
[options.data.class] | boolean | false | => 样式扩展 |