iview学习帮助文档

本文档详细介绍了iView框架的使用,包括安装、按需引用、全局配置、主题定制和各种组件的属性、事件与插槽。内容涵盖按钮、图标、布局、导航、表单、视图等多个方面,提供了丰富的示例和配置说明,帮助开发者更好地理解和应用iView。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

安装iview

npm install view-design --save

导入iview

在main.js中导入iview

import ViewUI from 'view-design';
import 'view-design/dist/styles/iview.css';
Vue.use(ViewUI);

按需引用iview组件

a.安装babel

npm install babel-plugin-import --save-dev

b.在 .babelrc 文件中

{
  "plugins": [["import", {
    "libraryName": "view-design",
    "libraryDirectory": "src/components"
  }]]
}

c.导入案例

import { Button, Table } from 'view-design';
Vue.component('Button', Button);
Vue.component('Table', Table);

组件规范

props 传递数据
slot 内容分发
events $emit @click 事件

使用:prop传递数据格式为 数字、布尔值或函数时,必须带:

Correct usage:
<Page :current="1" :total="100"></Page>

Incorrect usage:
<Page current="1" total="100"></Page>

全局配置

组件会优先使用 prop 设置的属性,如果未设置,再使用全局配置

Vue.use(ViewUI, {
    transfer: true,
    size: 'large',
    capture: false,
    select: {
        arrow: 'md-arrow-dropdown',
        arrowSize: 20
    }
});

解释:全局配置组件默认属性

  • transfer:所有带浮层的组件,是否将浮层放置在 body 内,默认为不设置,详见各组件默认的 transfer 值。可选值为 truefalse

  • size:所有带有 size 属性的组件的尺寸,默认为不设置,详见各组件默认的 size 值。可选值为 defaultsmalllarge

  • 4.0.0 capture:所有带下拉的组件是否开启 capture 模式,默认为 true。可选值为true或 false。

    capture 是浏览器的一种默认行为,如果开启,当可下拉的组件(例如 Select)处于展开状态时,点击外部操作不会立即响应,而是先收起下拉菜单,再次点击才会响应操作。

    如果不需要该特性,可以通过全局配置,将 capture 设置为 false。

  • select.arrow:Select 下拉箭头图标

  • select.customArrow:Select 自定义下拉箭头图标

  • select.arrowSize:Select 下拉箭头尺寸

  • cell.arrow:Cell 右侧箭头图标

  • cell.customArrow:Cell 自定义右侧箭头图标

  • cell.arrowSize:Cell 右侧箭头尺寸

  • menu.arrow:Menu 下拉箭头图标

  • menu.customArrow:Menu 自定义下拉箭头图标

  • menu.arrowSize:Menu 下拉箭头尺寸

  • tree.arrow:Tree 下拉箭头图标

  • tree.customArrow:Tree 自定义下拉箭头图标

  • tree.arrowSize:Tree 下拉箭头尺寸

  • cascader.arrow:Cascader 下拉箭头图标

  • cascader.customArrow:Cascader 自定义下拉箭头图标

  • cascader.arrowSize:Cascader 下拉箭头尺寸

  • cascader.itemArrow:Cascader 右侧箭头图标

  • cascader.customItemArrow:Cascader 自定义右侧箭头图标

  • cascader.itemArrowSize:Cascader 右侧箭头尺寸

  • colorPicker.arrow:ColorPicker 下拉箭头图标

  • colorPicker.customArrow:ColorPicker 自定义下拉箭头图标

  • colorPicker.arrowSize:ColorPicker 下拉箭头尺寸

  • datePicker.icon:DatePicker 日期图标

  • datePicker.customIcon:DatePicker 自定义日期图标

  • datePicker.iconSize:DatePicker 日期图标尺寸

  • timePicker.icon:TimePicker 时间图标

  • timePicker.customIcon:TimePicker 自定义时间图标

  • timePicker.iconSize:TimePicker 时间图标尺寸

  • tabs.closeIcon:Tabs 关闭图标

  • tabs.customCloseIcon:Tabs 自定义关闭图标

  • tabs.closeIconSize:Tabs 关闭图标尺寸

  • modal.maskClosable:Modal 的 maskClosable 属性

国际化

View UI(iView) 的所有组件文案默认使用的是中文,通过设置可以使用其它语言。

按需引入

import { locale, Page } from 'view-design';
import lang from 'view-design/dist/locale/en-US';
locale(lang);
Vue.component('Page', Page);

主题

View UI(iVIew)默认提供了一套 UI 主题,并且可以在一定程度上定制新主题

View UI(iVIew)的样式是基于 Less 进行开发的,默认以前缀 .ivu- 作为命名空间,并且定义了一套样式变量,定制主题,就是编辑这个变量列表。

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-dgh1xaiD-1616675667399)(C:\Users\123456\AppData\Roaming\Typora\typora-user-images\image-20210316095155712.png)]

定制主题:变量覆盖

a.在src下新建my-theme文件夹
b.在my-theme文件夹下新建index.less
C.在index.less中定义自己的主题
@import '~view-design/src/styles/index.less';
@primary-color: #8c0776;
....
d.在main.js中导入index.less
import '../my-theme/index.less';

DarkTheme深色主题样例

https://pro.iviewui.com/store/item/1247091768848158720?ref=iview

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-NpSUZ5hE-1616675667409)(C:\Users\123456\AppData\Roaming\Typora\typora-user-images\image-20210316095918343.png)]

View UI Loader

用于统一 View UI(iView) 标签书写规范,所有标签都可以使用首字母大写的形式

安装

npm install iview-loader --save-dev

配置

在vue项目根目录下的vue.config.js中的module中配置如下:

rules: [
        {
            test: /\.vue$/,
            use: [
                {
                    loader: 'vue-loader',
                    options: {
                        
                    }
                },
                {
                    loader: 'iview-loader',
                    options: {
                        prefix: false
                    }
                }
            ]
        }
    ]
  • 参数 prefix 设置为 true 后,所有 iView 组件标签名都可以使用前缀 i-,例如 <i-row><i-select>

    {
        'i-affix': 'Affix',
        'i-alert': 'Alert',
        'i-anchor': 'Anchor',
        'i-anchor-link': 'AnchorLink',
        'i-auto-complete': 'AutoComplete',
        'i-avatar': 'Avatar',
        'i-back-top': 'BackTop',
        'i-badge': 'Badge',
        'i-breadcrumb': 'Breadcrumb',
        'i-breadcrumb-item': 'BreadcrumbItem',
        'i-button': 'Button',
        'i-button-group': 'ButtonGroup',
        'i-card': 'Card',
        'i-carousel': 'Carousel',
        'i-carousel-item': 'CarouselItem',
        'i-cascader': 'Cascader',
        'i-cell': 'Cell',
        'i-cell-group': 'CellGroup',
        'i-checkbox': 'Checkbox',
        'i-checkbox-group': 'CheckboxGroup',
        'i-circle': 'i-circle',
        'i-col': 'Col',
        'i-collapse': 'Collapse',
        'i-color-picker': 'ColorPicker',
        'i-content': 'Content',
        'i-divider': 'Divider',
        'i-date-picker': 'DatePicker',
        'i-drawer': 'Drawer',
        'i-dropdown': 'Dropdown',
        'i-dropdown-item': 'DropdownItem',
        'i-dropdown-menu': 'DropdownMenu',
        'i-footer': 'Footer',
        'i-form': 'Form',
        'i-form-item': 'FormItem',
        'i-header': 'Header',
        'i-icon': 'Icon',
        'i-input': 'Input',
        'i-input-number': 'InputNumber',
        'i-layout': 'Layout',
        'i-list': 'List',
        'i-list-item': 'ListItem',
        'i-list-item-meta': 'ListItemMeta',
        'i-menu': 'Menu',
        'i-menu-group': 'MenuGroup',
        'i-menu-item': 'MenuItem',
        'i-sider': 'Sider',
        'i-submenu': 'Submenu',
        'i-modal': 'Modal',
        'i-option': 'Option',
        'i-option-group': 'OptionGroup',
        'i-page': 'Page',
        'i-panel': 'Panel',
        'i-poptip': 'Poptip',
        'i-progress': 'Progress',
        'i-radio': 'Radio',
        'i-radio-group': 'RadioGroup',
        'i-rate': 'Rate',
        'i-row': 'Row',
        'i-select': 'Select',
        'i-slider': 'Slider',
        'i-spin': 'Spin',
        'i-split': 'Split',
        'i-step': 'Step',
        'i-steps': 'Steps',
        'i-switch': 'i-switch',
        'i-table': 'Table',
        'i-tabs': 'Tabs',
        'i-tab-pane': 'TabPane',
        'i-tag': 'Tag',
        'i-time': 'Time',
        'i-timeline': 'Timeline',
        'i-timeline-item': 'TimelineItem',
        'i-time-picker': 'TimePicker',
        'i-tooltip': 'Tooltip',
        'i-transfer': 'Transfer',
        'i-tree': 'Tree',
        'i-upload': 'Upload'
    }
    

    组件

    基础

    color色彩

    [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-x60yYdNu-1616675667415)(C:\Users\123456\AppData\Roaming\Typora\typora-user-images\image-20210316102832952.png)]

    font字体
    字体预览

    [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-sm4eZzDF-1616675667425)(C:\Users\123456\AppData\Roaming\Typora\typora-user-images\image-20210316103009277.png)]

    字体代码
    font-family: "Helvetica Neue",Helvetica,"PingFang SC","Hiragino Sans GB","Microsoft YaHei","微软雅黑",Arial,sans-serif;
    
    字体使用规范
中文字体示例粗细颜色字号
主标题我是标题加粗#464c5b16px
次级标题我是标题加粗#464c5b14px
小标题我是标题加粗#464c5b12px
正文我是正文默认#65718012px
辅助文字我是辅助文字默认#9ea7b412px
失效文字我是失效文字默认#c3cbd612px
链接文字我是链接文字默认#3399ff12px
英文字体示例粗细颜色字号
Main HeadThis is an examplebold#464c5b16px
Sub HeadThis is an examplebold#464c5b14px
Small HeadThis is an examplebold#464c5b12px
TextThis is an examplenormal#65718012px
HelpThis is an examplenormal#9ea7b412px
DisabledThis is an examplenormal#c3cbd612px
LinkThis is an examplenormal#3399ff12px

基础

色彩
字体
按钮
按钮类型

按钮类型有:默认按钮、主按钮、虚线按钮、文字按钮以及四种颜色按钮。

通过设置typeprimarydashedtextinfosuccesswarningerror创建不同样式的按钮,不设置为默认样式。

幽灵按钮

幽灵按钮将其他按钮的内容反色,背景变为透明,常用在有色背景上。

图案按钮及按钮形状

通过设置icon属性在Button内嵌入一个Icon,或者直接在Button内使用Icon组件。

使用Buttonicon属性,图标位置将在最左边,如果需要自定义位置,需使用Icon组件。

通过设置shape属性为circle,可将按钮置为圆的形状。

按钮尺寸

按钮有三种尺寸:大、默认(中)、小

通过设置sizelargesmall将按钮设置为大和小尺寸,不设置为默认(中)尺寸。

长按钮

通过设置属性 long 可将按钮宽度设置为 100%,常用于弹窗内操作按钮。

使用者也可以直接通过给组件添加 style 来设置更细节的样式,比如定宽。

不可用状态

通过添加disabled属性可将按钮设置为不可用状态。

加载中状态

通过添加loading属性可以让按钮处于加载中状态,后两个按钮在点击时进入加载状态。

按钮组合

将多个Button放入ButtonGroup内,可实现按钮组合的效果。

通过设置ButtonGroup的属性sizelargesmall,可将按钮组尺寸设置为大和小,不设置size,则为默认(中)尺寸。

通过设置ButtonGroup的属性shapecircle,可将按钮组形状设置为圆角。

按钮纵向排列

通过设置ButtonGroup的属性vertical,可以使按钮组纵向排列。

跳转

通过设置 to 可以实现点击按钮直接跳转,支持传入 vue-router 对象。

设置 replace 则不会保存历史记录。

设置 target,会跟 a 标签一样的行为。

Button props
属性说明类型默认值
type按钮类型,可选值为 defaultprimarydashedtextinfosuccesswarningerror或者不设置Stringdefault
ghost幽灵属性,使按钮背景透明Booleanfalse
size按钮大小,可选值为largesmalldefault或者不设置Stringdefault
shape按钮形状,可选值为circle或者不设置String-
long开启后,按钮的长度为 100%Booleanfalse
html-type设置button原生的type,可选值为buttonsubmitresetStringbutton
disabled设置按钮为禁用状态Booleanfalse
loading设置按钮为加载中状态Booleanfalse
icon设置按钮的图标类型String-
custom-icon设置按钮的自定义图标String-
to跳转的链接,支持 vue-router 对象String | Object-
replace路由跳转时,开启 replace 将不会向 history 添加新记录Booleanfalse
target相当于 a 链接的 target 属性String_self
append 3.4.0同 vue-router appendBooleanfalse
ButtonGroup props
属性说明类型默认值
size按钮组合大小,可选值为largesmalldefault或者不设置Stringdefault
shape按钮组合形状,可选值为circle或者不设置String-
vertical是否纵向排列按钮组Booleanfalse
Icon
代码中使用
<Icon type="ios-checkmark" />
渲染后:
<i class="ivu-icon ivu-icon-ios-checkmark"></i>
Icon props
属性说明类型默认值
type图标的名称String-
size图标的大小,单位是 pxNumber | String-
color图标的颜色String-
custom自定义图标String-
自定义图标用法

View UI(iView) 的 Icon 支持使用第三方自定义图标,你可以引入任意的字体文件库来使用。

所有图标:http://v1.iviewui.com/components/icon#SYTB

布局

栅格

采用了24栅格系统,将区域进行24等分

  • 使用row在水平方向创建一行
  • 将一组col插入在row
  • 在每个col中,键入自己的内容
  • 通过设置colspan参数,指定跨越的范围,其范围是1到24
  • 每个row中的col总和应该为24
基础用法
<template>
    <Row>
        <Col span="12">col-12</Col>
        <Col span="12">col-12</Col>
    </Row>
    <br>
    <Row>
        <Col span="8">col-8</Col>
        <Col span="8">col-8</Col>
        <Col span="8">col-8</Col>
    </Row>
    <br>
    <Row>
        <Col span="6">col-6</Col>
        <Col span="6">col-6</Col>
        <Col span="6">col-6</Col>
        <Col span="6">col-6</Col>
    </Row>
</template>
Row props
属性说明类型默认值
gutter栅格间距,单位 px,左右平分Number0
type布局模式,可选值为flex或不选,在现代浏览器下有效。4.5.0 版本起强制使用 flex 布局String-
alignflex 布局下的垂直对齐方式,可选值为topmiddlebottomString-
justifyflex 布局下的水平排列方式,可选值为startendcenterspace-aroundspace-betweenString-
class-name自定义的class名称String-
wrap 4.5.0是否自动换行Booleantrue
Col props
属性说明类型默认值
span栅格的占位格数,可选值为0~24的整数,为 0 时,相当于display:noneNumber | String-
flex 4.5.0flex 布局属性Number | String-
order栅格的顺序,在flex布局模式下有效Number | String-
offset栅格左侧的间隔格数,间隔内不可以有栅格Number | String-
push栅格向右移动格数Number | String-
pull栅格向左移动格数Number | String-
class-name自定义的class名称String-
xs<576px 响应式栅格,可为栅格数或一个包含其他属性的对象Number | Object-
sm≥576px 响应式栅格,可为栅格数或一个包含其他属性的对象Number | Object-
md≥768px 响应式栅格,可为栅格数或一个包含其他属性的对象Number | Object-
lg≥992px 响应式栅格,可为栅格数或一个包含其他属性的对象Number | Object-
xl≥1200px 响应式栅格,可为栅格数或一个包含其他属性的对象Number | Object-
xxl≥1600px 响应式栅格,可为栅格数或一个包含其他属性的对象Number | Object-
Layout
Sider props
属性说明类型默认值
breakpoint触发响应式布局的断点,可选值为xs,sm,md,lg,xlxxl,若不设此属性则不会触发响应式布局。String-
value侧边栏是否收起,可使用 v-model 双向绑定数据。Booleanfalse
width宽度Number200
collapsible是否可收起,设为false后,默认触发器会隐藏,且响应式布局不会触发Booleanfalse
collapsed-width收缩宽度,设置为 0 会出现特殊 triggerNumber64
hide-trigger隐藏默认触发器Booleanfalse
default-collapsed是否默认收起,设置了collapsible后设置此属性侧边栏仍会收起。Booleanfalse
reverse-arrow改变侧边栏触发器箭头方向,和改变侧边栏收起方向,当Sider在右边时可以使用。Booleanfalse
Sider events
事件名说明返回值
on-collapse展开-收起时的回调true / false
Sider slot
名称说明
trigger自定义触发器
Sider methods
方法名说明
toggleCollapse改变Sider展开-收起状态。
List

最基础的列表展示,可承载文字、列表、图片、段落,常用于后台数据展示页面。

List props
属性说明类型默认值
border是否显示边框Booleanfalse
item-layout设置 ListItem 布局, 可选值为 horizontal(横排)或 vertical(竖直)Stringhorizontal
header列表头部String-
footer列表底部String-
loading列表是否正在加载Booleanfalse
size列表尺寸,可选值为 small、large、defaultStringdefault
split是否展示分割线Booleantrue
List slot
名称说明
header自定义列表头部
footer自定义列表底部
loading自定义加载中
ListItem slot
名称说明
action列表操作组,根据 item-layout 的不同, 位置在卡片底部或者最右侧
extra额外内容, 通常用在 item-layout 为 vertical 的情况下, 展示右侧内容; horizontal 展示在列表元素最右侧

ListItemMeta props

属性说明类型默认值
avatar列表元素的图标String-
title列表元素的标题String-
description列表元素的描述内容String-

ListItemMeta slot

名称说明
avatar自定义列表元素的图标
title自定义列表元素的标题
description自定义列表元素的描述内容
  • Card

    基础容器,用来显示文字、列表、图文等内容,也可以配合其它组件一起使用。

    Card props
    属性说明类型默认值
    bordered是否显示边框,建议在灰色背景下使用Booleantrue
    dis-hover禁用鼠标悬停显示阴影Booleanfalse
    shadow卡片阴影,建议在灰色背景下使用Booleanfalse
    padding卡片内部间距,单位 pxNumber16
    title标题,2.12.0 新增String-
    icon标题前的图标,2.12.0 新增String-
    to 4.0.0跳转的链接,支持 vue-router 对象String | Object-
    replace 4.0.0路由跳转时,开启 replace 将不会向 history 添加新记录Booleanfalse
    target 4.0.0相当于 a 链接的 target 属性String_self
    append 4.0.0同 vue-router appendBooleanfalse
    Card slot
    名称说明
    title自定义卡片标题,如果是简单文字,可以使用<p>标签包裹
    extra额外显示的内容,默认位置在右上角
    卡片主体内容
Collapse

将内容区域折叠/展开。

Collapse props
属性说明类型默认值
value当前激活的面板的 name,可以使用 v-model 双向绑定Array | String-
accordion是否开启手风琴模式,开启后每次至多展开一个面板Booleanfalse
simple是否开启简洁模式Booleanfalse
Collapse events
事件名说明返回值
on-change切换面板时触发,返回当前已展开的面板的 key,格式为数组[]
Panel props
属性说明类型默认值
name当前面板的 name,与 Collapse的value对应,不填为索引值Stringindex
hide-arrow隐藏箭头Booleanfalse
Panel slot
名称说明
面板头内容
content描述内容
Split

可将一片区域,分割为可以拖拽调整宽度或高度的两部分区域。

Split props
属性说明类型默认值
value面板位置,可以是 0~1 代表百分比,或具体数值的像素,可用 v-model 双向绑定Number | String0.5
mode类型,可选值为 horizontal 或 verticalStringhorizontal
min最小阈值Number | String40px
max最大阈值Number | String40px
Split events
事件名说明返回值
on-move-start拖拽开始-
on-moving拖拽中event
on-move-end拖拽结束-
Split slot
名称说明
leftmode 为 horizontal 时可用,左边面板
rightmode 为 horizontal 时可用,右边面板
topmode 为 vertical 时可用,上边面板
bottommode 为 vertical 时可用,下边面板
trigger自定义分割拖拽节点
  • Divider
    Divider props
    属性说明类型默认值
    type水平还是垂直类型,可选值为 horizontal 或 verticalStringhorizontal
    orientation分割线标题的位置,可选值为 left、right 或 centerNumbercenter
    dashed是否虚线Booleanfalse
    plain 4.5.0文字是否显示为普通正文样式Booleanfalse
    size 3.3.0尺寸,可选值为 small 或 defaultStringdefault
Cell
CellGroup events
事件名说明返回值
on-click点击单元格时触发name
Cell props
属性说明类型默认值
name用来标识这一项String | Number-
title左侧标题String-
label标题下方的描述信息String-
extra右侧额外内容String-
disabled禁用该项Booleanfalse
selected标记该项为选中状态Booleanfalse
to跳转的链接,支持 vue-router 对象String | Object-
replace路由跳转时,开启 replace 将不会向 history 添加新记录Booleanfalse
target相当于 a 链接的 target 属性String_self
append 3.4.0同 vue-router appendBooleanfalse
Cell slot
名称说明
默认相当于 title
icon标题前的 Icon
label相当于 label
extra相当于 extra
arrow有链接时,可自定义右侧箭头

导航

Menu

为页面和功能提供导航的菜单列表,常用于网站顶部和左侧。

Menu props
属性说明类型默认值
mode菜单类型,可选值为 horizontal(水平) 和 vertical(垂直)Stringvertical
theme主题,可选值为 lightdarkprimary,其中 primary 只适用于 mode="horizontal"Stringlight
active-name激活菜单的 name 值String | Number-
open-names展开的 Submenu 的 name 集合Array[]
accordion是否开启手风琴模式,开启后每次至多展开一个子菜单Booleanfalse
width导航菜单的宽度,只在 mode="vertical" 时有效,如果使用 Col 等布局,建议设置为 autoString240px
Menu events
事件名说明返回值
on-select选择菜单(MenuItem)时触发name
on-open-change当 展开/收起 子菜单时触发当前展开的 Submenu 的 name 值数组
Menu methods
方法名说明参数
updateOpened手动更新展开的子目录,注意要在 $nextTick 里调用
updateActiveName手动更新当前选择项,注意要在 $nextTick 里调用
MenuItem props
属性说明类型默认值
name菜单项的唯一标识,必填String | Number-
to跳转的链接,支持 vue-router 对象String | Object-
replace路由跳转时,开启 replace 将不会向 history 添加新记录Booleanfalse
target相当于 a 链接的 target 属性String_self
append 3.4.0同 vue-router appendBooleanfalse
Submenu props
属性说明类型默认值
name子菜单的唯一标识,必填String | Number-
Submenu slot
名称说明
菜单项
title子菜单标题
MenuGroup props
属性说明类型默认值
title分组标题String
  • Tabs

    选项卡切换组件,常用于平级区域大块内容的的收纳和展现。

    Tabs props
    属性说明类型默认值
    value当前激活 tab 面板的 name,可以使用 v-model 双向绑定数据String默认为第一项的 name
    type页签的基本样式,可选值为 linecardStringline
    size尺寸,可选值为 defaultsmall,仅在 type="line" 时有效Stringdefault
    closable是否可以关闭页签,仅在 type="card" 时有效Booleanfalse
    animated是否使用 CSS3 动画Booleantrue
    capture-focusTabs 内的表单类组件是否自动获得焦点Booleanfalse
    before-remove关闭前的函数,返回 Promise 可阻止标签关闭Function-
    name 3.3.1当嵌套使用 Tabs,指定 name 区分层级String-
    draggable 4.3.0开启可配合事件 @on-drag-drop 实现拖拽调整页签顺序,详见示例Booleanfalse
    Tabs events
    事件名说明返回值
    on-clicktab 被点击时触发name
    on-tab-removetab 被关闭时触发name
    on-contextmenu 4.3.0当前页签点击右键时触发data, event, position
    on-drag-drop 4.3.0拖拽调整页签顺序时触发name1, name2, index1, index2, names
    Tabs slot
    名称说明
    extra附加内容
    contextMenu 4.3.0右键菜单,详见示例
    TabPane props
    属性说明类型默认值
    name用于标识当前面板,对应 value,默认为其索引值String-
    label选项卡头显示文字,支持 Render 函数。 学习 Render 函数的内容String | Function
    icon选项卡图标String-
    disabled是否禁用该选项卡Booleanfalse
    closable是否可以关闭页签,仅在 type="card" 时有效Booleannull
    tab 3.3.1当嵌套使用 Tabs,设置该属性指向对应 Tabs 的 name 字段String-
    index 3.3.1在 TabPane 使用 v-if 时,并不会按照预先的顺序渲染,这时可设置 index,并从小到大排序(需大于 0)Number-
    context-menu 4.3.0是否支持右键菜单Booleanfalse
Dropdown

展示一组折叠的下拉菜单.

Dropdown props
属性说明类型默认值
trigger触发方式,可选值为 hover(悬停)click(点击)contextMenu(右键)custom(自定义),使用 custom 时,需配合 visible 一起使用Stringhover
visible手动控制下拉框的显示,在 trigger = ‘custom’ 时使用Booleanfalse
placement下拉菜单出现的位置,可选值为top``top-start``top-end``bottom``bottom-start``bottom-end``left``left-start``left-end``right``right-start``right-end, 2.12.0 版本开始支持自动识别Stringbottom
transfer是否将弹层放置于 body 内,在 Tabs、带有 fixed 的 Table 列内使用时,建议添加此属性,它将不受父级样式影响,从而达到更好的效果Booleanfalse
transfer-class-name 3.3.0开启 transfer 时,给浮层添加额外的 class 名称String-
stop-propagation 3.4.0是否开启 stop-propagationBooleanfalse
Dropdown events
事件名说明返回值
on-click点击菜单项时触发DropdownItem 的 name 值
on-visible-change菜单显示状态改变时调用visible
on-clickoutside点击外部关闭下拉菜单时触发event
Dropdown slot
名称说明
主体内容
list列表内容,一般由 DropdownMenu 承担
DropdownItem props
属性说明类型默认值
name用来标识这一项String-
disabled禁用该项Booleanfalse
divided显示分割线Booleanfalse
selected标记该项为选中状态Booleanfalse
  • Page

    当数据量较多时,使用分页可以快速进行数据切换。

    Page props
    属性说明类型默认值
    current当前页码,支持 .sync 修饰符Number1
    total数据总数Number0
    page-size每页条数Number10
    page-size-opts每页条数切换的配置Array[10, 20, 30, 40]
    placement条数切换弹窗的展开方向,可选值为 bottomtopStringbottom
    size可选值为small(迷你版)或不填(默认)String-
    simple简洁版Booleanfalse
    show-total显示总数Booleanfalse
    show-elevator显示电梯,可以快速切换到某一页Booleanfalse
    show-sizer显示分页,用来改变page-sizeBooleanfalse
    class-name自定义 class 名称String-
    styles自定义 style 样式Object-
    transfer是否将弹层放置于 body 内,在 Tabs、带有 fixed 的 Table 列内使用时,建议添加此属性,它将不受父级样式影响,从而达到更好的效果Booleanfalse
    prev-text替代图标显示的上一页文字String-
    next-text替代图标显示的下一页文字String-
    disabled 4.0.0是否禁用Booleanfalse
    Page events
    事件名说明返回值
    on-change页码改变的回调,返回改变后的页码页码
    on-page-size-change切换每页条数时的回调,返回切换后的每页条数page-size
    Page slot
    名称说明
    自定义显示总数的内容
Breadcrumb

显示网站的层级结构,告知用户当前所在位置,以及在需要向上级导航时使用。

Breadcrumb props
属性说明类型默认值
separator自定义分隔符String | Element String/
BreadcrumbItem props
属性说明类型默认值
to链接,不传则没有链接,支持 vue-router 对象String | Object-
replace路由跳转时,开启 replace 将不会向 history 添加新记录Booleanfalse
target相当于 a 链接的 target 属性String_self
append 3.4.0同 vue-router appendBooleanfalse
Badge

主要用于通知未读数的角标,提醒用户点击。

Badge props
属性说明类型默认值
count显示的数字,大于overflowCount时,显示${overflowCount}+,为 0 时隐藏Number-
overflow-count展示封顶的数字值Number | String99
dot不展示数字,只有一个小红点,如需隐藏 dot ,需要设置count为 0Booleanfalse
class-name自定义的class名称,dot 模式下无效String-
type使用预设的颜色,可选值为 success、primary、normal、error、warning、infoString-
show-zero当数值为 0 时,是否展示 BadgeBooleanfalse
status设置 Badge 为状态点,可选值为 success、processing、default、error、warningString-
text自定义内容,如果设置了 status,则为状态点的文本String-
offset设置状态点的位置偏移,格式为 [x, y]Array-
color 4.0.0设置更多状态点的颜色或自定义颜色String-
Badge slot
名称说明
count 4.0.0自定义角标显示内容(去角标背景),数值 count 将无效。
text 4.0.0自定义角标显示内容(带角标背景),数值 count 将无效。亦可自定义状态点模式下的 text 内容。
Anchor

用于跳转到页面指定位置。

Anchor props
属性说明类型默认值
affix固定模式Booleantrue
offset-top距离窗口顶部达到指定偏移量后触发Number0
offset-bottom距离窗口底部达到指定偏移量后触发Number-
bounds锚点区域边界,单位:pxNumber5
scroll-offset点击滚动的额外距离Number0
container指定滚动的容器String | HTMLElement-
show-ink是否显示小圆点Booleanfalse
Anchor events
事件名说明返回值
on-select点击锚点时触发,返回链接href
on-change链接改变时触发,返回新链接和旧链接newHref, oldHref
AnchorLink props
属性说明类型默认值
href锚点链接String-
title文字内容String-
scroll-offset点击滚动的额外距离Number0
Steps

拆分某项流程的步骤,引导用户按流程完成任务。

Steps props
属性说明类型默认值
current当前步骤,从 0 开始计数Number0
status当前步骤的状态,可选值为waitprocessfinisherrorStringprocess
size步骤条的尺寸,可选值为small或者不写String-
direction步骤条的方向,可选值为horizontal(水平)或vertical(垂直)Stringhorizontal
Step props
属性说明类型默认值
status步骤的状态,可选值为waitprocessfinisherror,不设置时自动判断Stringprocess
title标题String
content步骤的详细描述,可选String-
icon步骤的图标,可选String-
Step slot
名称说明
title 4.0.0自定义 title
content 4.0.0自定义 content
icon 4.0.0自定义 icon
LoadingBar

全局创建一个显示页面加载、异步请求、文件上传等的加载进度条。

LoadingBar 只会在全局创建一个,因此在任何位置调用的方法都会控制这同一个组件

LoadingBar instance
  • this.$Loading.start()
  • this.$Loading.finish()
  • this.$Loading.error()
  • this.$Loading.update(percent)
函数名说明参数
start开始从 0 显示进度条,并自动加载进度
finish结束进度条,自动补全剩余进度
error以错误的类型结束进度条,自动补全剩余进度
update精确加载到指定的进度percent,指定的进度百分比
  • this.$Loading.config(options)
  • this.$Loading.destroy()
this.$Loading.config({
    color: '#5cb85c',
    failedColor: '#f0ad4e',
    height: 5
});
属性说明类型默认值
color进度条的颜色,默认为 iView 主色Stringprimary
failedColor失败时的进度条颜色,默认为 iView 主色Stringerror
height进度条高度,单位 pxNumber2
duration 3.4.0隐藏时的持续时间,单位 msNumber800

表单

Form
Input
Radio
Checkbox
Switch
Table
<Table border :columns="column" :data="row"></Table>
Table props
属性说明类型默认值
data显示的结构化数据,其中,字段 cellClassName 用于设置任意单元格的样式名称,因此数据不能使用该字段,详见示例特定样式Array[]
columns表格列的配置描述,具体项见后文Array[]
stripe是否显示间隔斑马纹Booleanfalse
border是否显示纵向边框Booleanfalse
show-header是否显示表头Booleantrue
width表格宽度,单位 pxNumber | String自动
height表格高度,单位 px,设置后,如果表格内容大于此值,会固定表头Number | String-
max-height 3.4.0表格最大高度,单位 px,设置后,如果表格内容大于此值,会固定表头Number | String-
loading表格是否加载中Booleanfalse
disabled-hover禁用鼠标悬停时的高亮Booleanfalse
highlight-row是否支持高亮选中的行,即单选Booleanfalse
row-class-name行的 className 的回调方法,传入参数:row:当前行数据index:当前行的索引Function-
size表格尺寸,可选值为 largesmalldefault 或者不填String-
no-data-text数据为空时显示的提示内容String暂无数据
no-filtered-data-text筛选数据为空时显示的提示内容String暂无筛选结果
draggable 3.3.0是否开启拖拽调整行顺序,需配合 @on-drag-drop 事件使用Booleanfalse
tooltip-theme 3.3.0列使用 tooltip 时,配置它的主题,可选值为 dark 或 lightStringdark
tooltip-max-width 4.5.0列使用 tooltip 时,配置 Tooltip 的最大宽,默认是 300Number300
row-key 3.4.0是否强制使用内置的 row-key,开启后可能会影响性能,4.1.0 支持 StringBoolean | Stringfalse
span-method 4.0.0合并行或列的计算方法Function-
show-summary 4.0.0是否在表尾显示合计行Booleanfalse
sum-text 4.0.0合计行第一列的文本String合计
summary-method 4.0.0自定义的合计计算方法Function-
indent-size 4.1.0树形数据缩进宽度,单位 pxNumber16
load-data 4.1.0异步加载树形数据的方法,详见示例Function-
update-show-children 4.4.0展开树形数据时,是否需要更新 _showChildren 字段,使用异步树形数据时建议开启Booleanfalse
context-menu 4.1.0当前行点击右键是否会阻止默认行为Booleanfalse
show-context-menu 4.2.0点击右键弹出菜单,需配合 slot contextMenu 一起使用,详见示例Booleanfalse
Table events
事件名说明返回值
on-current-change开启 highlight-row 后有效,当表格的当前行发生变化的时候会触发currentRow:当前高亮行的数据oldCurrentRow:上一次高亮的数据
on-select在多选模式下有效,选中某一项时触发selection:已选项数据row:刚选择的项数据
on-select-cancel在多选模式下有效,取消选中某一项时触发selection:已选项数据row:取消选择的项数据
on-select-all在多选模式下有效,点击全选时触发selection:已选项数据
on-select-all-cancel在多选模式下有效,点击取消全选时触发selection:已选项数据
on-selection-change在多选模式下有效,只要选中项发生变化时就会触发selection:已选项数据
on-sort-change排序时有效,当点击排序时触发column:当前列数据key:排序依据的指标order:排序的顺序,值为 ascdesc
on-filter-change筛选时有效,筛选条件发生变化时触发当前列数据
on-row-click单击某一行时触发当前行的数据index
on-row-dblclick双击某一行时触发当前行的数据index
on-cell-click 4.2.0点击单元格时触发row, column, data, event
on-expand展开或收起某一行时触发row:当前行的数据status:当前的状态
on-drag-drop 3.3.0拖拽排序松开时触发,返回置换的两行数据索引index1, index2
on-column-width-resize 4.0.0拖拽调整列宽时触发newWidth, oldWidth, column, event
on-contextmenu 4.1.0当前行点击右键时触发row, event, position
on-expand-tree 4.3.0展开或收起子数据时触发row-key, status
Table slot
名称说明
header表头
footer页脚
loading加载中
contextMenu 4.2.0右键菜单,详见示例
Table methods
方法名说明参数
exportCsv将数据导出为 .csv 文件,说明:支持IE9~IE11、Edge、Chrome、Safari、Firefox 全系列浏览器。IE9、Safari 需要手动修改后缀名为 .csv。IE9暂时只支持英文,中文会显示为乱码。params(Object):filename 文件名,默认为 table.csvoriginal 是否导出为原始数据,默认为 truenoHeader 不显示表头,默认为 falsecolumns 自定义导出的列数据data 自定义导出的行数据callback 添加此函数后,不会下载,而是返回数据separator 数据分隔符,默认是逗号(,)quoted 每项数据是否加引号,默认为 false说明:columns 和 data 需同时声明,声明后将导出指定的数据,建议列数据有自定义render时,可以根据需求自定义导出内容
clearCurrentRow清除高亮项,仅在开启 highlight-row 时可用
selectAll全选/取消全选,详见示例status
column
属性说明类型默认值
type列类型,可选值为 index、selection、expand、htmlString-
title列头显示文字String#
key对应列内容的字段名String-
width列宽Number-
minWidth最小列宽Number-
maxWidth最大列宽Number-
align对齐方式,可选值为 left 左对齐、right 右对齐和 center 居中对齐Stringleft
className列的样式名称String-
fixed列是否固定在左侧或者右侧,可选值为 left 左侧和 right 右侧String-
ellipsis开启后,文本将不换行,超出部分显示为省略号Booleanfalse
tooltip开启后,文本将不换行,超出部分显示为省略号,并用 Tooltip 组件显示完整内容Booleanfalse
tooltipTheme 4.5.0配置 Tooltip 的主题,可选值为 dark 或 lightStringdark
tooltipMaxWidth 4.5.0配置 Tooltip 的最大宽,默认是 300Number300
render自定义渲染列,使用 Vue 的 Render 函数。传入两个参数,第一个是 h,第二个为对象,包含 row、column 和 index,分别指当前行数据,当前列数据,当前行索引,详见示例。 学习 Render 函数的内容Function-
renderHeader自定义列头显示内容,使用 Vue 的 Render 函数。传入两个参数,第一个是 h,第二个为对象,包含 columnindex,分别为当前列数据和当前列索引。Function-
indexMethodtype 为 index 时可用,自定义序号Function,参数 row 为当前行内容-
sortable对应列是否可以排序,如果设置为 custom,则代表用户希望远程排序,需要监听 Table 的 on-sort-change 事件Boolean | ‘custom’false
sortMethod自定义排序使用的方法,接收三个参数 a 、 b 和 type,当设置 sortable: true 时有效。type 值为 asc 和 descFunction-
sortType设置初始化排序。值为 asc 和 descString-
filters过滤数据的选项,格式为数组,数组中每项包含 labelvalue 属性,使用过滤,必须同时配置 filterMethodArray-
filterMethod数据过滤使用的方法,如果是多选的筛选项,对每一条数据会执行多次,任意一次返回 true 就会显示Function-
filterMultiple数据过滤的选项是否多选Booleantrue
filteredValue在初始化时使用过滤,数组,值为需要过滤的 value 集合Array-
filterRemote使用远程过滤Function-
children表头分组Array-
resizable 4.0.0该列是否允许拖拽调整宽度,需开启 border 属性,且设置 widthBooleanfalse
tree 4.1.0指定该列为显示展开/收起图标,树形数据时使用Boolean-
display 4.2.0使用 slot 自定义列时,列的渲染模式。可选值为 block、inline、inline-block,当使用树形数据时,建议使用 inline 或 inline-blockString-
  • Select
    <Select v-model="model1" style="width:200px">        
        <Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>   </Select>
    
    Select props
    属性说明类型默认值
    value指定选中项目的 value 值,可以使用 v-model 双向绑定数据。单选时只接受 String 或 Number,多选时只接受 ArrayString | Number | Array
    multiple是否支持多选Booleanfalse
    disabled是否禁用Booleanfalse
    clearable是否可以清空选项,只在单选时有效Booleanfalse
    filterable是否支持搜索Booleanfalse
    filter-by-label 4.2.0在搜索时,是否只按照 label 进行搜索Booleanfalse
    remote是否使用远程搜索Booleanfalse
    remote-method远程搜索的方法Function-
    loading当前是否正在远程搜索Booleanfalse
    loading-text远程搜索中的文字提示String加载中
    label仅在 remote 模式下,初始化时使用。因为仅通过 value 无法得知选项的 label,需手动设置。String | Number | Array
    default-label4.4.0远程搜索时,显示默认 label,详见示例String | Number | Array-
    size选择框大小,可选值为largesmalldefault或者不填String-
    placeholder选择框默认文字String请选择
    not-found-text当下拉列表为空时显示的内容String无匹配数据
    label-in-value在返回选项时,是否将 label 和 value 一并返回,默认只返回 valueBooleanfalse
    placement弹窗的展开方向,可选值为 topbottomtop-startbottom-starttop-endbottom-endStringbottom-start
    transfer是否将弹层放置于 body 内,在 Tabs、带有 fixed 的 Table 列内使用时,建议添加此属性,它将不受父级样式影响,从而达到更好的效果Booleanfalse
    element-id给表单元素设置 id,详见 Form 用法。String-
    transfer-class-name 3.3.0开启 transfer 时,给浮层添加额外的 class 名称String-
    prefix3.4.0在 Select 内显示图标String-
    max-tag-count 3.4.0多选时最多显示多少个 tagNumber-
    max-tag-placeholder 3.4.0隐藏 tag 时显示的内容,参数是剩余项数量Function-
    allow-create4.0.0是否允许用户创建新条目,需开启 filterableBooleanfalse
    capture 4.0.0是否开启 capture 模式,也可通过全局配置Booleantrue
    Select events
    事件名说明返回值
    on-change选中的Option变化时触发,默认返回 value,如需返回 label,详见 label-in-value 属性当前选中项
    on-query-change搜索词改变时触发query
    on-clear点击清空按钮时触发
    on-open-change下拉框展开或收起时触发true / false
    on-create 4.0.0新建条目时触发query
    on-select 4.1.0选择项目时触发当前选中项
    on-set-default-options 4.4.0配合 default-label 使用,详见示例options
    Select methods
    方法名说明参数
    setQuery设置搜索词,为空时清空,仅在 filterable="true" 时有效query
    clearSingleSelect清空单选项,仅在 clearable="true" 时有效
    Select slot
    名称说明
    prefix 3.4.0自定义 Select 内头部图标
    Option props
    属性说明类型默认值
    value选项值,默认根据此属性值进行筛选,必填String | Number
    label选项显示的内容,默认会读取 slot,无 slot 时,优先读取该 label 值,无 label 时,读取 value。当选中时,选择器会显示 label 为已选文案。大部分情况不需要配置此项,直接写入 slot 即可,在自定义选项时,该属性非常有用。String-
    disabled是否禁用当前项Booleanfalse
    tag 4.0.0设置后,在多选时,标签内容会优先显示设置的值String | Number-
    OptionGroup props
    属性说明类型默认值
    label分组的组名String
  • AutoCompelet
    <AutoComplete
            v-model="value1"
            :data="data1"
            @on-search="handleSearch1"
            placeholder="input here"
            style="width:200px">
    </AutoComplete>
    
    AutoComplete props
    属性说明类型默认值
    value绑定的值,可使用 v-model 双向绑定String | Number-
    data自动完成的数据源Array[]
    clearable是否可以清空选项Booleanfalse
    disabled是否禁用Booleanfalse
    placeholder占位文本String-
    size输入框尺寸,可选值为 largesmalldefault 或者不设置String-
    icon输入框尾部图标String-
    filter-method是否根据输入项进行筛选。当其为一个函数时,会接收 valueoption 两个参数,当 option 符合筛选条件时,应返回 true,反之则返回 falseFunction | Booleanfalse
    placement弹窗的展开方向,可选值为 bottomtoptop-startbottom-starttop-endbottom-end,2.12.0 版本开始支持自动识别Stringbottom-start
    transfer是否将弹层放置于 body 内,在 Tabs、带有 fixed 的 Table 列内使用时,建议添加此属性,它将不受父级样式影响,从而达到更好的效果Booleanfalse
    element-id给表单元素设置 id,详见 Form 用法。String-
    transfer-class-name 4.4.0开启 transfer 时,给浮层添加额外的 class 名称String-
    AutoComplete events
    事件名说明返回值
    on-change选中 option,或 input 的 value 变化时,调用此函数value
    on-select被选中时调用,参数为选中项的 value 值value
    on-search搜索补全项的时候调用query
    on-focus聚焦时触发event
    on-blur失焦时触发event
    on-clear 3.3.0清空时触发
  • Slider
    <Slider v-model="value1"></Slider>
    
    Slider props
    属性说明类型默认值
    value滑块选定的值,可以使用 v-model 双向绑定数据。普通模式下,数据格式为数字,在双滑块模式下,数据格式为长度是2的数组,且每项都为数字Number | Array0
    min最小值Number0
    max最大值Number100
    step步长,取值建议能被(max - min)整除Number1
    disabled是否禁用滑块Booleanfalse
    range是否开启双滑块模式Booleanfalse
    show-input是否显示数字输入框,仅在单滑块模式下有效Booleanfalse
    show-stops是否显示间断点,建议在 step 不密集时使用Booleanfalse
    show-tip提示的显示控制,可选值为 hover(悬停,默认)、always(总是可见)、never(不可见)Stringhover
    tip-formatSlider 会把当前值传给 tip-format,并在 Tooltip 中显示 tip-format 的返回值,若为 null,则隐藏 TooltipFunctionvalue
    input-size数字输入框的尺寸,可选值为largesmalldefault或者不填,仅在开启 show-input 时有效Stringdefault
    active-change 3.4.0同 InputNumber 的 active-changeBooleantrue
    marks 4.0.0标记, key 的类型必须为 number 且取值在闭区间 [min, max] 内,每个标记可以单独设置样式Object-
    Slider events
    事件名说明返回值
    on-change在松开滑动时触发,返回当前的选值,在滑动过程中不会触发value
    on-input滑动条数据变化时触发,返回当前的选值,在滑动过程中实时触发value
  • DatePicker
    <DatePicker type="date" placeholder="Select date" style="width: 200px"></DatePicker>
    
    DatePicker props
    属性说明类型默认值
    type显示类型,可选值为 datedaterangedatetimedatetimerangeyearmonthStringdate
    value日期,可以是 JavaScript 的 Date,例如 new Date(),也可以是标准的日期格式,点击右边查看 注意:value 使用 v-model 时,值是 Date 类型,可以配合 @on-change 使用[ Date](javascript:void(0))-
    format展示的日期格式[ Date](javascript:void(0))date | daterange: yyyy-MM-dddatetime | datetimerange: yyyy-MM-dd HH:mm:ssyear:yyyymonth:yyyy-MM
    placement日期选择器出现的位置,可选值为top``top-start``top-end``bottom``bottom-start``bottom-end``left``left-start``left-end``right``right-start``right-end,2.12.0 版本开始支持自动识别Stringbottom-start
    placeholder占位文本String
    options选择器额外配置,比如不可选日期与快捷选项,具体项详见下表Object-
    split-panels开启后,左右面板不联动,仅在 daterangedatetimerange 下可用。Booleanfalse
    multiple开启后,可以选择多个日期,仅在 date 下可用。Booleanfalse
    show-week-numbers开启后,可以显示星期数。Booleanfalse
    start-date设置默认显示的起始日期。Date-
    confirm是否显示底部控制栏,开启后,选择完日期,选择器不会主动关闭,需用户确认后才可关闭Booleanfalse
    open手动控制日期选择器的显示状态,true 为显示,false 为收起。使用该属性后,选择器不会主动关闭。建议配合 slot 及 confirm 和相关事件一起使用Booleannull
    size尺寸,可选值为largesmalldefault或者不设置String-
    disabled是否禁用选择器Booleanfalse
    clearable是否显示清除按钮Booleantrue
    readonly完全只读,开启后不会弹出选择器,只在没有设置 open 属性下生效Booleanfalse
    editable文本框是否可以输入,只在没有使用 slot 时有效Booleantrue
    transfer是否将弹层放置于 body 内,在 Tabs、带有 fixed 的 Table 列内使用时,建议添加此属性,它将不受父级样式影响,从而达到更好的效果Booleanfalse
    element-id给表单元素设置 id,详见 Form 用法。String-
    time-picker-options可以在 type 为 datetime 和 datetimerange 下,配置 TimePicker 的属性,比如时间间隔 steps::time-picker-options="{steps: [1, 10, 10]}"Object{}
    separator 3.3.0两个日期间的分隔符String-
    capture 4.0.0是否开启 capture 模式,也可通过全局配置Booleantrue
    transfer-class-name 4.4.0开启 transfer 时,给浮层添加额外的 class 名称String-
    options
    属性说明类型默认值
    shortcuts设置快捷选项,每项内容:text | String:显示的文案value | Function:返回指定的日期,如需自己控制逻辑,可不设置,并使用 onClick 回调onClick | Function:点击时的回调,参数为当前日期选择器的 Vue 实例,当需要自定义复杂操作时,可以使用Array-
    disabledDate设置不可选择的日期,参数为当前的日期,需要返回 Boolean 是否禁用这天Function-
    DatePicker events
    事件名说明返回值
    on-change日期发生变化时触发返回两个值,已经格式化后的日期,比如 2016-01-01,和当前的日期类型,比如 date
    on-open-change弹出日历和关闭日历时触发true | false
    on-ok在 confirm 模式下有效,点击确定按钮时触发-
    on-clear在 confirm 模式或 clearable = true 时有效,在清空日期时触发-
    on-clickoutside 3.4.0点击外部关闭下拉菜单时触发event
    DatePicker slot
    名称说明
    自定义选择器的显示内容,建议与 open 等参数一起使用,详见示例
  • TimePicker
    <TimePicker type="time" placeholder="Select time" style="width: 168px"></TimePicker>
    
    TimePicker props
    属性说明类型默认值
    type显示类型,可选值为 timetimerangeStringtime
    value时间,可以是 JavaScript 的 Date,例如 new Date(),也可以是标准的时间格式,点击右边查看 注意:value 使用 v-model 时,值是 Date 类型,可以配合 @on-change 使用[ Date](javascript:void(0))-
    format展示的时间格式[ Date](javascript:void(0))HH:mm:ss
    steps下拉列表的时间间隔,数组的三项分别对应小时、分钟、秒。例如设置为 [1, 15] 时,分钟会显示:00、15、30、45。Array[]
    placement时间选择器出现的位置,可选值为top``top-start``top-end``bottom``bottom-start``bottom-end``left``left-start``left-end``right``right-start``right-end,2.12.0 版本开始支持自动识别Stringbottom-start
    placeholder占位文本String
    confirm是否显示底部控制栏Booleanfalse
    open手动控制时间选择器的显示状态,true 为显示,false 为收起。使用该属性后,选择器不会主动关闭。建议配合 slot 及 confirm 和相关事件一起使用Booleannull
    size尺寸,可选值为largesmalldefault或者不设置String-
    disabled是否禁用选择器Booleanfalse
    clearable是否显示清除按钮Booleantrue
    readonly完全只读,开启后不会弹出选择器,只在没有设置 open 属性下生效Booleanfalse
    editable文本框是否可以输入,只在没有使用 slot 时有效Booleantrue
    transfer是否将弹层放置于 body 内,在 Tabs、带有 fixed 的 Table 列内使用时,建议添加此属性,它将不受父级样式影响,从而达到更好的效果Booleanfalse
    element-id给表单元素设置 id,详见 Form 用法。String-
    separator 3.3.0两个日期间的分隔符String-
    capture 4.0.0是否开启 capture 模式,也可通过全局配置Booleantrue
    transfer-class-name 4.4.0开启 transfer 时,给浮层添加额外的 class 名称String-
    TimePicker events
    事件名说明返回值
    on-change时间发生变化时触发已经格式化后的时间,比如 09:41:00
    on-open-change弹出浮层和关闭浮层时触发true | false
    on-ok点击确定按钮时触发-
    on-clear在清空日期时触发-
    TimePicker slot
    名称说明
    自定义选择器的显示内容,建议与 open 等参数一起使用,详见示例
  • Cascader
    <Cascader :data="data" v-model="value1"></Cascader>
    
    Cascader props
    属性说明类型默认值
    data可选项的数据源,格式参照示例说明Array[]
    value当前已选项的数据,格式参照示例说明Array[]
    render-format选择后展示的函数,用于自定义显示格式Functionlabel => label.join(’ / ')
    disabled是否禁用选择器Booleanfalse
    clearable是否支持清除Booleantrue
    placeholder输入框占位符String请选择
    trigger次级菜单展开方式,可选值为 clickhoverStringclick
    change-on-select当此项为 true 时,点选每级菜单选项值都会发生变化,具体见上面的示例Booleanfalse
    size输入框大小,可选值为largesmall或者不填String-
    load-data动态获取数据,数据源需标识 loadingFunction-
    filterable是否支持搜索Booleanfalse
    not-found-text当搜索列表为空时显示的内容String无匹配数据
    transfer是否将弹层放置于 body 内,在 Tabs、带有 fixed 的 Table 列内使用时,建议添加此属性,它将不受父级样式影响,从而达到更好的效果Booleanfalse
    element-id给表单元素设置 id,详见 Form 用法。String-
    transfer-class-name 4.4.0开启 transfer 时,给浮层添加额外的 class 名称String-
    Cascader events
    事件名说明返回值
    on-change选择完成后的回调,返回值 value 即已选值 value,selectedData 为已选项的具体数据value, selectedData
    on-visible-change展开和关闭弹窗时触发显示状态,Boolean
  • Transfer
    <Transfer
            :data="data1"
            :target-keys="targetKeys1"
            :render-format="render1"
            @on-change="handleChange1">
    </Transfer>
    
    Transfer props
    属性说明类型默认值
    data数据源,其中的数据将会被渲染到左边一栏中,targetKeys 中指定的除外。Array[]
    targetKeys显示在右侧框数据的key集合Array[]
    render-format每行数据渲染函数,该函数的入参为 data 中的项Function默认显示label,没有时显示key
    selected-keys设置哪些项应该被选中Array[]
    list-style两个穿梭框的自定义样式Object{}
    titles标题集合,顺序从左至右Array[‘源列表’, ‘目的列表’]
    operations操作文案集合,顺序从上至下Array[]
    reverse-operation 4.2.0是否颠倒两个操作按钮的上下顺序Booleanfalse
    filterable是否显示搜索框Booleanfalse
    filter-placeholder搜索框的占位String请输入搜索内容
    filter-method自定义搜索函数,入参为 data 和 query,data 为项,query 为当前输入的搜索词Function默认搜索label
    not-found-text当列表为空时显示的内容String列表为空
    Transfer events
    事件名说明返回值
    on-change选项在两栏之间转移时的回调函数targetKeys, direction, moveKeys
    on-selected-change选中项发生变化时触发sourceSelectedKeys, targetSelectedKeys
    Transfer slot
    名称说明
    自定义底部内容
  • InputNumber
    <InputNumber :max="10" :min="1" v-model="value1"></InputNumber>
    
    InputNumber props
    属性说明类型默认值
    max最大值NumberInfinity
    min最小值Number-Infinity
    value当前值,可以使用 v-model 双向绑定数据Number1
    controls-outside 4.5.0按钮位置是否置于两侧Booleanfalse
    step每次改变的步伐,可以是小数Number1
    size输入框尺寸,可选值为largesmalldefault或者不填String-
    disabled设置禁用状态Booleanfalse
    placeholder占位文本String-
    formatter指定输入框展示值的格式Function-
    parser指定从 formatter 里转换回数字的方式,和 formatter 搭配使用Function-
    readonly是否设置为只读Booleanfalse
    editable是否可编辑Booleantrue
    precision数值精度Number-
    element-id给表单元素设置 id,详见 Form 用法。String-
    active-change是否实时响应数据,设置为 false 时,只会在失焦时更改数据Booleantrue
    InputNumber events
    事件名说明返回值
    on-change数值改变时的回调,返回当前值当前值
    on-focus聚焦时触发event
    on-blur失焦时触发-
  • Rate
    <Rate v-model="value" />
    
    Rate props
    属性说明类型默认值
    countstar 总数Number5
    value当前 star 数,可以使用 v-model 双向绑定数据Number0
    allow-half是否允许半选Booleanfalse
    disabled是否只读,无法进行交互Booleanfalse
    show-text是否显示提示文字Booleanfalse
    clearable是否可以取消选择Booleanfalse
    character自定义字符String-
    icon使用图标String-
    custom-icon使用自定义图标String-
  • Upload
    <Upload action="//jsonplaceholder.typicode.com/posts/">
            <Button icon="ios-cloud-upload-outline">Upload files</Button>
    </Upload>
    
    Upload props
    属性说明类型默认值
    action上传的地址,必填String-
    headers设置上传的请求头部Object{}
    multiple是否支持多选文件Booleanfalse
    paste是否支持粘贴上传文件Booleanfalse
    webkitdirectory 4.4.0是否开启选择文件夹,部分浏览器适用Booleanfalse
    disabled 3.3.0是否禁用Booleanfalse
    data上传时附带的额外参数Object-
    name上传的文件字段名Stringfile
    with-credentials支持发送 cookie 凭证信息Booleanfalse
    show-upload-list是否显示已上传文件列表Booleantrue
    type上传控件的类型,可选值为 select(点击选择),drag(支持拖拽)Stringselect
    accept接受上传的文件类型String-
    format支持的文件类型,与 accept 不同的是,format 是识别文件的后缀名,accept 为 input 标签原生的 accept 属性,会在选择文件时过滤,可以两者结合使用Array[]
    max-size文件大小限制,单位 kbNumber-
    before-upload上传文件之前的钩子,参数为上传的文件,若返回 false 或者 Promise 则停止上传Function-
    on-progress文件上传时的钩子,返回字段为 event, file, fileListFunction-
    on-success文件上传成功时的钩子,返回字段为 response, file, fileListFunction-
    on-error文件上传失败时的钩子,返回字段为 error, file, fileListFunction-
    on-preview点击已上传的文件链接时的钩子,返回字段为 file, 可以通过 file.response 拿到服务端返回数据Function-
    on-remove文件列表移除文件时的钩子,返回字段为 file, fileListFunction-
    on-format-error文件格式验证失败时的钩子,返回字段为 file, fileListFunction-
    on-exceeded-size文件超出指定大小限制时的钩子,返回字段为 file, fileListFunction-
    default-file-list默认已上传的文件列表,例如:[ { name: 'img1.jpg', url: 'http://www.xxx.com/img1.jpg' }, { name: 'img2.jpg', url: 'http://www.xxx.com/img2.jpg' } ]Array[]
    Upload methods
    方法名说明参数
    clearFiles清空已上传的文件列表
    Upload slot
    名称说明
    触发上传组件的控件
    tip辅助提示内容
  • ColorPicker
    <ColorPicker v-model="color1" />
    
    ColorPicker props
    属性说明类型默认值
    value绑定的值,可使用 v-model 双向绑定String-
    disabled是否禁用Booleanfalse
    editable是否可以输入色值Booleantrue
    alpha是否支持透明度选择Booleanfalse
    hue是否支持色彩选择Booleantrue
    recommend是否显示推荐的颜色预设Booleanfalse
    colors自定义颜色预设Array[]
    format颜色的格式,可选值为 hsl、hsv、hex、rgbString开启 alpha 时为 rgb,其它为 hex
    size尺寸,可选值为largesmalldefault或者不设置String-
    transfer是否将弹层放置于 body 内,在 Tabs、带有 fixed 的 Table 列内使用时,建议添加此属性,它将不受父级样式影响,从而达到更好的效果Booleanfalse
    capture 4.0.0是否开启 capture 模式,也可通过全局配置Booleantrue
    transfer-class-name 4.4.0开启 transfer 时,给浮层添加额外的 class 名称String-
    ColorPicker events
    事件名说明返回值
    on-change当绑定值变化时触发当前值
    on-active-change面板中当前显示的颜色发生改变时触发当前显示的颜色值
    on-open-change下拉框展开或收起时触发true / false

视图

<ColorPicker v-model="color1" />
Alert
<Alert type="success">A success prompt</Alert>
Alert props
属性说明类型默认值
type警告提示样式,可选值为infosuccesswarningerrorStringinfo
closable是否可关闭Booleanfalse
show-icon是否显示图标Booleanfalse
Alert events
事件名说明返回值
on-close关闭时触发event
Alert slot
名称说明
警告提示内容
desc警告提示辅助性文字介绍
icon自定义图标内容
close自定义关闭内容
Message
<Button type="primary" @click="info">Display info prompt</Button>
Message instance
  • this.$Message.info(config)
  • this.$Message.success(config)
  • this.$Message.warning(config)
  • this.$Message.error(config)
  • this.$Message.loading(config)
属性说明类型默认值
content提示内容String-
render自定义描述内容,使用 Vue 的 Render 函数Function-
duration自动关闭的延时,单位秒,不关闭可以写 0Number1.5
onClose关闭时的回调Function-
closable是否显示关闭按钮Booleanfalse
background 4.0.0是否显示背景色Booleanfalse
  • this.$Message.config(options)
  • this.$Message.destroy()
this.$Message.config({
    top: 50,
    duration: 3
});
属性说明类型默认值
top提示组件距离顶端的距离,单位像素Number24
duration默认自动关闭的延时,单位秒Number1.5
Notice
 <Button type="primary" @click="open(false)">Open notice</Button>
 <Button @click="open(true)">Open notice(only title)</Button>
Notice instance
  • this.$Notice.open(config)
  • this.$Notice.info(config)
  • this.$Notice.success(config)
  • this.$Notice.warning(config)
  • this.$Notice.error(config)
属性说明类型默认值
title通知提醒的标题String-
desc通知提醒的内容,为空或不填时,自动应用仅标题模式下的样式String-
render自定义描述内容,使用 Vue 的 Render 函数,如果同时设置了 render 和 desc,则只显示 render 的内容Function-
duration自动关闭的延时,单位秒,不关闭可以写 0Number4.5
name当前通知的唯一标识String自动
onClose关闭时的回调Function-
  • this.$Notice.config(options)
  • this.$Notice.close(name)
  • this.$Notice.destroy()
this.$Notice.config({
    top: 50,
    duration: 3
});
属性说明类型默认值
top通知组件距离顶端的距离,单位像素Number24
duration默认自动关闭的延时,单位秒Number4.5
Modal
<Button type="primary" @click="modal1 = true">Display dialog box</Button>
    <Modal
        v-model="modal1"
        title="Common Modal dialog box title"
        @on-ok="ok"
        @on-cancel="cancel">
        <p>Content of dialog</p>
        <p>Content of dialog</p>
        <p>Content of dialog</p>
    </Modal>
Modal props
属性说明类型默认值
value对话框是否显示,可使用 v-model 双向绑定数据。Booleanfalse
title对话框标题,如果使用 slot 自定义了页头,则 title 无效String-
closable是否显示右上角的关闭按钮,关闭后 Esc 按键也将关闭Booleantrue
mask-closable是否允许点击遮罩层关闭Booleantrue
loading点击确定按钮时,确定按钮是否显示 loading 状态,开启则需手动设置value来关闭对话框Booleanfalse
scrollable页面是否可以滚动Booleanfalse
fullscreen是否全屏显示Booleanfalse
draggable是否可以拖拽移动Booleanfalse
mask是否显示遮罩层,开启 draggable 时,强制不显示Booleantrue
ok-text确定按钮文字String确定
cancel-text取消按钮文字String取消
width对话框宽度,对话框的宽度是响应式的,当屏幕尺寸小于 768px 时,宽度会变为自动auto。当其值不大于 100 时以百分比显示,大于 100 时为像素Number | String520
footer-hide不显示底部Booleanfalse
styles设置浮层样式,调整浮层位置等,该属性设置的是.ivu-modal的样式Object-
class-name设置对话框容器.ivu-modal-wrap的类名,可辅助实现垂直居中等自定义效果String-
z-index层级Number1000
transition-names自定义显示动画,第一项是模态框,第二项是背景Array[‘ease’, ‘fade’]
transfer是否将弹层放置于 body 内Booleantrue
lock-scroll 4.4.0是否禁止对页面滚动条的修改Booleanfalse
Modal events
事件名说明返回值
on-ok点击确定的回调
on-cancel点击取消的回调
on-visible-change显示状态发生变化时触发true / false
Modal slot
名称说明
header自定义页头
footer自定义页脚内容
close自定义右上角关闭内容
对话框主体内容
Modal instance
  • this.$Modal.info(config)
  • this.$Modal.success(config)
  • this.$Modal.warning(config)
  • this.$Modal.error(config)
  • this.$Modal.confirm(config)
  • this.$Modal.remove()
属性说明类型默认值
title标题String | Element String-
content内容String | Element String-
render自定义内容,使用后不再限制类型, content 也无效。 学习 Render 函数的内容Function-
width宽度,单位 pxNumber | String416
okText确定按钮的文字String确定
cancelText取消按钮的文字,只在Modal.confirm()下有效String取消
loading点击确定按钮时,确定按钮是否显示 loading 状态,开启则需手动调用Modal.remove()来关闭对话框Booleanfalse
scrollable页面是否可以滚动Booleanfalse
closable是否可以按 Esc 键关闭Booleanfalse
onOk点击确定的回调Function-
onCancel点击取消的回调,只在Modal.confirm()下有效Function-
lock-scroll 4.4.0是否禁止对页面滚动条的修改Booleanfalse
Drawer
<Button @click="value1 = true" type="primary">Open</Button>
<Drawer title="Basic Drawer" :closable="false" v-model="value1">
    <p>Some contents...</p>
    <p>Some contents...</p>
    <p>Some contents...</p>
</Drawer>
Drawer props
属性说明类型默认值
value抽屉是否显示,可使用 v-model 双向绑定数据Booleanfalse
title抽屉标题,如果使用 slot 自定义了页头,则 title 无效String-
width抽屉宽度。当其值不大于 100 时以百分比显示,大于 100 时为像素Number | String256
closable是否显示右上角的关闭按钮Booleantrue
mask-closable是否允许点击遮罩层关闭Booleantrue
mask是否显示遮罩层Booleantrue
mask-style遮罩层样式Object-
styles抽屉中间层的样式Object-
scrollable页面是否可以滚动Booleanfalse
placement抽屉的方向,可选值为 left 或 rightStringright
transfer是否将抽屉放置于 body 内Booleantrue
class-name设置抽屉容器.ivu-drawer-wrap的类名String-
inner是否设置抽屉在某个元素内打开,开启此属性时,应当关闭 transfer 属性Booleanfalse
draggable 3.3.0是否开启拖拽调整宽度Booleanfalse
before-close 3.3.0返回 Promise 可以阻止关闭Function-
lock-scroll 4.4.0是否禁止对页面滚动条的修改Booleanfalse
Drawer events
事件名说明返回值
on-close关闭抽屉时触发
on-visible-change显示状态发生变化时触发true / false
on-resize-width 3.3.0调整宽度时触发width
Drawer slot
名称说明
header自定义标题栏
close自定义右上角关闭内容
trigger 3.3.0自定义调整宽度节点
默认抽屉主体内容
Tree
<Tree :data="data1"></Tree>
Tree props
属性说明类型默认值
data可嵌套的节点属性的数组,生成 tree 的数据Array[]
multiple是否支持多选Booleanfalse
show-checkbox是否显示多选框Booleanfalse
empty-text没有数据时的提示String暂无数据
load-data异步加载数据的方法,见示例Function-
render自定义渲染内容,见示例Function-
children-key定义子节点键Stringchildren
check-strictly在显示复选框的情况下,是否严格的遵循父子不互相关联的做法Booleanfalse
check-directly 3.3.0开启后,在 show-checkbox 模式下,select 的交互也将转为 checkBooleanfalse
select-node 4.4.0开启后,点击节点将使用单选效果Booleantrue
expand-node 4.4.0开启后,点击节点将使用展开/收起子节点效果,该选项优先于 select-nodeBooleanfalse
Tree events
事件名说明返回值
on-select-change点击树节点时触发当前已选中的节点数组、当前项
on-check-change点击复选框时触发当前已勾选节点的数组、当前项
on-toggle-expand展开和收起子列表时触发当前节点的数据
on-contextmenu 4.3.0当前节点点击右键时触发data, event, position
Tree slot
名称说明
contextMenu 4.3.0右键菜单,详见示例
Tree methods
方法名说明参数
getCheckedNodes获取被勾选的节点
getSelectedNodes获取被选中的节点
getCheckedAndIndeterminateNodes获取选中及半选节点
children
属性说明类型默认值
title标题String | Element String-
expand是否展开直子节点Booleanfalse
disabled禁掉响应Booleanfalse
disableCheckbox禁掉 checkboxBooleanfalse
selected是否选中子节点Booleanfalse
checked是否勾选(如果勾选,子节点也会全部勾选)Booleanfalse
children子节点属性数组Array-
render自定义当前节点渲染内容,见示例Function-
contextmenu 4.3.0是否支持右键菜单Booleanfalse
Tooltip
<Tooltip content="Here is the prompt text">
        A balloon appears when the mouse passes over this text
</Tooltip>
Tooltip props
属性说明类型默认值
content显示的内容String | Number
placement提示框出现的位置,可选值为top``top-start``top-end``bottom``bottom-start``bottom-end``left``left-start``left-end``right``right-start``right-end,2.12.0 版本开始支持自动识别Stringbottom
disabled是否禁用提示框Booleanfalse
delay延迟显示,单位毫秒Number0
always是否总是可见Booleanfalse
theme主题,可选值为 dark 或 lightStringdark
max-width最大宽度,超出最大值后,文本将自动换行,并两端对齐String | Number-
offset出现位置的偏移量Number0
transfer是否将弹层放置于 body 内,在 Tabs、带有 fixed 的 Table 列内使用时,建议添加此属性,它将不受父级样式影响,从而达到更好的效果Booleanfalse
options自定义 popper.js 的配置项,具体配置见 popper.js 文档Object{ modifiers: { computeStyle:{ gpuAcceleration: false, }, preventOverflow :{ boundariesElement: 'window' } } }
transfer-class-name 4.4.0开启 transfer 时,给浮层添加额外的 class 名称String-
Tooltip events
事件名说明返回值
on-popper-show在提示框显示时触发
on-popper-hide在提示框消失时触发
Tooltip slot
名称说明
主体内容
content提示框的内容,定义此 slot 时,会覆盖 props content
Poptip
<Poptip trigger="hover" title="Title" content="content">
    <Button>Hover</Button>
</Poptip>
Poptip props
属性说明类型默认值
trigger触发方式,可选值为hover(悬停)click(点击)focus(聚焦),在 confirm 模式下,只有 click 有效Stringclick
title显示的标题String | Number-
content显示的正文内容,只在非 confirm 模式下有效String | Number
placement提示框出现的位置,可选值为top``top-start``top-end``bottom``bottom-start``bottom-end``left``left-start``left-end``right``right-start``right-end,2.12.0 版本开始支持自动识别Stringtop
width宽度,最小宽度为 150px,在 confirm 模式下,默认最大宽度为 300pxString | Number-
confirm是否开启对话框模式Booleanfalse
disabled 3.4.0是否禁用Booleanfalse
ok-text确定按钮的文字,只在 confirm 模式下有效String确定
cancel-text取消按钮的文字,只在 confirm 模式下有效String取消
transfer是否将弹层放置于 body 内,在 Tabs、带有 fixed 的 Table 列内使用时,建议添加此属性,它将不受父级样式影响,从而达到更好的效果Booleanfalse
popper-class给 Poptip 设置 class-name,在使用 transfer 时会很有用String-
word-wrap开启后,超出指定宽度文本将自动换行,并两端对齐Booleanfalse
padding自定义间距值String8px 16px
offset出现位置的偏移量Number0
options自定义 popper.js 的配置项,具体配置见 popper.js 文档Object{ modifiers: { computeStyle:{ gpuAcceleration: false, }, preventOverflow :{ boundariesElement: 'window' } } }
transfer-class-name 4.4.0开启 transfer 时,给浮层添加额外的 class 名称String-
Poptip events
事件名说明返回值
on-popper-show在提示框显示时触发
on-popper-hide在提示框消失时触发
on-ok点击确定的回调,只在 confirm 模式下有效
on-cancel点击取消的回调,只在 confirm 模式下有效
Poptip slot
名称说明
主体内容
title提示框标题,定义此 slot 时,会覆盖 props title
content提示框内容,定义此 slot 时,会覆盖 props content,只在非 confirm 模式下有效
Progress
<Progress :percent="25" />
Progress props
属性说明类型默认值
percent百分比Number0
status状态,可选值为normalactivewrongsuccessStringnormal
stroke-width进度条的线宽,单位 pxNumber10
stroke-color 3.3.0进度条的颜色,4.0.0 开始支持传入数组,显示为渐变色String | Array-
hide-info隐藏数值或状态图标Booleanfalse
vertical是否在垂直方向显示Booleanfalse
success-percent已完成的分段百分比Number0
text-inside 4.0.0百分比是否置于进度条内Booleanfalse
Progress slot
名称说明
自定义显示状态内容
Avatar
<Avatar icon="ios-person" size="large" />
<Avatar>USER</Avatar>
Avatar props
属性说明类型默认值
shape指定头像的形状,可选值为 circle、squareStringcircle
size设置头像的大小,可选值为 large、small、default,4.0.0 版本开始支持设置具体数值String | Numberdefault
src图片类头像的资源地址String-
icon设置头像的图标类型,参考 Icon 组件String-
custom-icon自定义图标String-
Avatar events
事件名说明返回值
on-error 3.3.0在设置 src 且图片加载不成功时触发event
Tag
<Tag type="border">标签三</Tag>
<Tag type="border" closable>标签四</Tag>
<Tag type="dot">标签一</Tag>
<Tag type="dot" closable>标签二</Tag>
Tag props
属性说明类型默认值
closable标签是否可以关闭Booleanfalse
checkable标签是否可以选择Booleanfalse
checked标签的选中状态Booleantrue
type标签的样式类型,可选值为 borderdot或不填String-
color标签颜色,预设颜色值为defaultprimarysuccesswarningerrorbluegreenredyellowpinkmagentavolcanoorangegoldlimecyangeekbluepurple,你也可以自定义颜色值。Stringdefault
name当前标签的名称,使用 v-for,并支持关闭时,会比较有用String | Number-
fade是否在出现和消失时使用渐变的动画,动画时长可能会引起占位的闪烁Booleantrue
size 4.0.0尺寸,可选值为 large、medium、defaultStringdefault
Tag events
事件名说明返回值
on-close关闭时触发event, name
on-change切换选中状态时触发checked, name
Carousel
 <Carousel v-model="value1" loop>
     <CarouselItem>
         <div class="demo-carousel">1</div>
     </CarouselItem>
     <CarouselItem>
         <div class="demo-carousel">2</div>
     </CarouselItem>
     <CarouselItem>
         <div class="demo-carousel">3</div>
     </CarouselItem>
     <CarouselItem>
         <div class="demo-carousel">4</div>
     </CarouselItem>
</Carousel>
Carousel props
属性说明类型默认值
value幻灯片的索引,从 0 开始,可以使用 v-model 双向绑定数据Number0
height走马灯的高度,可填 auto 或具体高度数值,单位 pxString | Numberauto
loop是否开启循环Booleanfalse
autoplay是否自动切换Booleanfalse
autoplay-speed自动切换的时间间隔,单位为毫秒Number2000
dots指示器的位置,可选值为 inside (内部),outside(外部),none(不显示)Stringinside
radius-dot是否显示圆形指示器Booleanfalse
trigger指示器的触发方式,可选值为 click(点击),hover(悬停)Stringclick
arrow切换箭头的显示时机,可选值为 hover(悬停),always(一直显示),never(不显示)Stringhover
easing动画效果Stringease
Carousel events
事件名说明返回值
on-change幻灯片切换时触发,目前激活的幻灯片的索引,原幻灯片的索引oldValue, value
on-click 4.1.0点击幻灯片时触发,返回索引值index
Timeline
<Timeline>
    <TimelineItem>
        <p class="time">1976年</p>
        <p class="content">Apple I 问世</p>
    </TimelineItem>
    <TimelineItem>
        <p class="time">1984年</p>
        <p class="content">发布 Macintosh</p>
    </TimelineItem>
    <TimelineItem>
        <p class="time">2007年</p>
        <p class="content">发布 iPhone</p>
    </TimelineItem>
    <TimelineItem>
        <p class="time">2010年</p>
        <p class="content">发布 iPad</p>
    </TimelineItem>
    <TimelineItem>
        <p class="time">2011年10月5日</p>
        <p class="content">史蒂夫·乔布斯去世</p>
    </TimelineItem>
</Timeline>
Timeline props
属性说明类型默认值
pending指定是否最后一个节点为幽灵节点Booleanfalse
TimelineItem props
属性说明类型默认值
color圆圈颜色,可选值为blueredgreen,或自定义色值Stringblue
TimelineItem slot
名称说明
dot自定义时间轴点内容
基本内容
Time
<Time :time="time1" />
<br>
<Time :time="time2" />
Time props
属性说明类型默认值
time需要对比的时间,可以是时间戳或 Date 类型Number | Date | String-
type类型,可选值为 relative、date 或 datetimeStringrelative
interval自动更新的间隔,单位:秒Number60
hash填写该值,点击会定位锚点String-

图表

Circle
<Circle :percent="80">
    <span class="demo-Circle-inner" style="font-size:24px">80%</span>
</Circle>
Circle props
属性说明类型默认值
percent百分比Number0
size图表的宽度和高度,单位 pxNumber120
stroke-linecap进度环顶端的形状,可选值为square(方)和round(圆)Stringround
stroke-width进度环的线宽,单位 pxNumber6
stroke-color进度环的颜色,4.0.0 版本开始支持传入数组显示为渐变色String | Array#2db7f5
trail-width进度环背景的线宽,单位 pxNumber5
trail-color进度环背景的颜色String#eaeef2
dashboard是否显示为仪表盘Booleanfalse
Circle slot
名称说明
自定义显示中间内容,内容默认垂直居中

其他

Affix
<Affix>
    <span class="demo-affix">Fixed at the top</span>
</Affix>
Affix props
属性说明类型默认值
offset-top距离窗口顶部达到指定偏移量后触发Number0
offset-bottom距离窗口底部达到指定偏移量后触发Number-
use-capture 4.1.0addEventListener 原生的 useCapture 选项Booleanfalse
Affix events
事件名说明返回值
on-change在固定状态发生改变时触发true | false
Back Top
<BackTop></BackTop>
BackTop props
属性说明类型默认值
height页面滚动高度达到该值时才显示BackTop组件Number400
bottom组件距离底部的距离Number30
right组件距离右部的距离Number30
duration滚动动画持续时间,单位 毫秒Number1000
BackTop events
事件名说明返回值
on-click点击按钮时触发
Spin
<Spin></Spin>
Spin props
属性说明类型默认值
sizeSpin尺寸,可选值为largesmall或者不设置String-
fix是否固定,需要父级有relativeabsoluteBooleanfalse
Spin slot
名称说明
自定义 Spin 的内容,设置slot后,默认的样式不生效
Scroll
<Scroll :on-reach-bottom="handleReachBottom">
    <Card dis-hover v-for="(item, index) in list1" :key="index" style="margin: 32px 0">
        Content {{ item }}
    </Card>
</Scroll>
Scroll props
属性说明类型默认值
height滚动区域的高度,单位像素String | Number300
loading-text加载中的文案String加载中
on-reach-top滚动至顶部时触发,需返回 PromiseFunction-
on-reach-bottom滚动至底部时触发,需返回 PromiseFunction-
on-reach-edge滚动至顶部或底部时触发,需返回 PromiseFunction-
distance-to-edge从边缘到触发回调的距离。如果是负的,回调将在到达边缘之前触发。值最好在 24 以下。Number | Array[20, 20]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值