新特性
- 综合
- 新增
theme-chalk
主题 - 增强以下组件的可访问性:Alert、AutoComplete、Breadcrumb、Button、Checkbox、Collapse、Input、InputNumber、Menu、Progress、Radio、Rate、Slider、Switch 和 Upload
- 新增布局组件 Container、Header、Aside、Main 和 Footer
- 新增 TypeScript 类型声明
- 重绘了全部图标,并新增了部分图标
- 新增了一系列基于断点的工具类,用于当视口尺寸满足一定条件时隐藏元素
- 新增全局配置组件尺寸的功能。在引入 Element 时,配置
size
字段可以改变所有组件的默认尺寸
- 新增
- Button
- 新增
round
属性,用于圆角按钮 #6643
- 新增
- TimeSelect
- 可以用
Up
、Down
导航,用Enter
选中时间 #6023
- 可以用
- TimePicker
- Tree
- Tag
- 新增
size
属性 #7203
- 新增
- Datepicker
- MessageBox
- Dialog
- ColorPicker
- Message
- Notification
- Rate
- 新增
show-score
属性,控制是否在右侧显示当前分数 #6295
- 新增
- Tabs
- 新增
tab-position
属性,控制选项面板内容显示的上、下、左、右四个方向 #6096
- 新增
- Radio
- 增加
border
属性和size
属性 #6690
- 增加
- Checkbox
- 增加
border
属性和size
属性 #6690
- 增加
- Alert
- 新增
center
属性,提供居中布局 #6876
- 新增
- Menu
- Form
- Input
- 新增
suffix
、prefix
的 slot,以及suffixIcon
、prefixIcon
属性,用于给输入框内部增加前置和后置内容 #7032
- 新增
- Breadcrumb
- 新增
separator-class
属性,可使用图标作为分隔符 #7203
- 新增
- Steps
- 新增
simple
属性,用于开启简洁风格的步骤条 #7274
- 新增
- Pagination
- 新增
prev-text
和next-text
属性,用于自定义上一页和下一页的文本 #7005
- 新增
- Loading
- 配置对象新增
spinner
和background
字段,支持自定义加载图标和背景色,#7390
- 配置对象新增
- Autocomplete
- 新增
debounce
属性,#7413
- 新增
- Upload
- 新增
limit
和on-exceed
属性,支持对上传文件的个数进行限制,#7405
- 新增
- DateTimePicker
- 新增
time-arrow-control
属性,用于开启时间选择器的arrow-control
,#7438
- 新增
- Layout
- 新增断点
xl
,适用于宽度大于 1920px 的视口
- 新增断点
- Table
- 新增
span-method
属性,用于合并行或列 - 新增
clearSort
方法,用于清空排序状态 - 新增
clearFilter
方法,用于清空过滤状态 - 对于可展开行,当该行展开时会获得一个
.expanded
类名,方便自定义样式 - 新增
size
属性,用于控制表格尺寸 - 新增
toggleRowExpansion
方法,用于手动展开或关闭行 - 新增
cell-class-name
属性,用于指定单元格的类名 - 新增
cell-style
属性,用于指定单元格的样式 - 新增
header-row-class-name
属性,用于指定表头行的类名 - 新增
header-row-style
属性,用于指定表头行的样式 - 新增
header-cell-class-name
属性,用于指定表头单元格的类名 - 新增
header-cell-style
属性,用于指定表头单元格的样式 - TableColumn 的
prop
属性支持object[key]
格式 - TableColumn 新增
index
属性,用于自定义索引值
- 新增
- Select
- 新增
reserve-keyword
属性,用于在选择某个选项后保留当前的搜索关键词
- 新增
修复
- DatePicker
- DateTimePicker
- TimePicker
- 失去焦点时无法正确改变
v-model
值的问题 #6023
- 失去焦点时无法正确改变
- Dialog
- 当含有下拉框时,下拉框的打开和关闭会造成文字虚晃的问题 #6088
- Select
- 提升性能,修复组件销毁时可能导致 Vue dev-tool 卡死的问题 #6151
- Table
- 修复 Table 在父元素从
display: none
变成其他状态时会隐藏的问题 - 修复 Table 在父元素为
display: flex
时可能出现的宽度逐渐变大的问题 - 修复
append
具名 slot 和固定列并存时,动态获取表格数据会导致固定列消失的问题 - 修复
expand-row-keys
属性初始化无效的问题 - 修复
data
改变时过滤条件失效的问题 - 修复多级表头时固定列隐藏情况计算错误的问题
- 修复
max-height
变更后无法恢复的问题 - 修复一些样式上的计算错误
- 修复 Table 在父元素从
非兼容性更新
- 综合
- 移除
theme-default
- 最低兼容 Vue 2.5.2 和 IE 10
- 表单组件的
change
事件和 Pagination 的current-change
事件现在仅响应用户交互 - Button 和表单组件的
size
属性不再接受large
值,可接受medium
、small
和mini
- 为了方便使用第三方图标,Button 的
icon
属性、Input 的prefix-icon
和suffix-icon
属性、Steps 的icon
属性现在需要传入完整的图标类名
- 移除
- Dialog
- 移除
size
属性。现在 Dialog 的尺寸由width
和fullscreen
控制 - 移除通过
v-model
控制 Dialog 显示和隐藏的功能
- 移除
- Rate
text-template
属性更名为score-template
- Dropdown
menu-align
属性变更为placement
,增加更多方位属性
- Transfer
footer-format
属性更名为format
- Switch
- 由于
on-*
属性在 JSX 中会被识别为事件,导致 Switch 所有on-*
属性在 JSX 中无法正常工作,所以on-*
属性更名为active-*
,对应地,off-*
属性更名为inactive-*
。受到影响的属性有:on-icon-class
、off-icon-class
、on-text
、off-text
、on-color
、off-color
、on-value
、off-value
active-text
和inactive-text
属性不再有默认值
- 由于
- Tag
type
属性现在支持success
、info
、warning
和danger
四个值
- Menu
- 移除
theme
属性。现在通过background-color
、text-color
和active-text-color
属性进行颜色的自定义
- 移除
- Input
- 移除
icon
属性。现在通过suffix-icon
属性或者suffix
具名 slot 来加入尾部图标 - 移除
on-icon-click
属性和click
事件。现在如果需要为输入框中的图标添加点击事件,请以具名 slot 的方式添加图标 change
事件现在仅在输入框失去焦点或用户按下回车时触发,与原生 input 元素一致。如果需要实时响应用户的输入,可以使用input
事件
- 移除
- Autocomplete
- 移除
custom-item
属性。现在通过scoped slot
自定义输入建议列表项的内容 - 移除
props
属性,现在使用value-key
属性指定输入建议对象中用于显示的键名
- 移除
- Steps
- 移除
center
属性 - 现在步骤条将默认充满父容器
- DatePicker
change
事件参数现在为组件的绑定值,格式由value-format
控制
- 移除
- Table
- 移除通过
inline-template
自定义列模板的功能 sort-method
现在和Array.sort
保持一致的逻辑,要求返回一个数字- 将
append
slot 移至tbody
元素以外,以保证其只被渲染一次 expand
事件更名为expand-change
,以保证 API 的命名一致性row-class-name
和row-style
的函数参数改为对象,以保证 API 的一致性
- 移除通过
* 在网站上动态渲染任意 HTML 是非常危险的,因为容易导致 XSS 攻击。因此请在 dangerouslyUseHTMLString
打开的情况下,确保 message
的内容是可信的,永远不要将用户提交的内容赋值给 message
属性。
New features
- General
- A new theme:
theme-chalk
- Accessibility of the following components are improved: Alert, AutoComplete, Breadcrumb, Button, Checkbox, Collapse, Input, InputNumber, Menu, Progress, Radio, Rate, Slider, Switch, Upload
- Added TypeScript typings
- All existing icons are redesigned. Some new icons are added
- Added a series of breakpoint-based utility classes that hide elements when the viewport size meets certain conditions
- Added layout components: Container, Header, Aside, Main, Footer
- Now you can configure component sizes globally. When importing Element, you can add a global config object with a
size
prop to configure default sizes for all components.
- A new theme:
- Button
- Added
round
attribute. It's used for round-cornered Buttons #6643
- Added
- TimeSelect
- Now can be navigated by
Up
andDown
, and hittingEnter
selects the time #6023
- Now can be navigated by
- TimePicker
- Tree
- Tag
- Added
size
attribute #7203
- Added
- Datepicker
- Now
timeFormat
can format the TimePicker when type is set todatetimerange
#6052 - Added
start-placeholder
andend-placeholder
. They're placeholders for the two input boxes in range mode #7169 - Added
value-format
attribute to customize the format of the binding value, #7367 - Added
unlink-panels
attribute to unlink the two date panels when selecting a date range
- Now
- MessageBox
- Added
closeOnHashChange
attribute #6043 - Added
center
attribute so that the content can be centered #7029 - Added
roundButton
attribute to display round Buttons #7029 - Added
dangerouslyUseHTMLString
attribute. When set totrue
,message
will be parsed as HTML string* #6043 - Added
inputType
attribute to assign type for the inner input box, #7651
- Added
- Dialog
- ColorPicker
- Message
- Notification
- Rate
- Added
show-score
attribute to determine if current score is displayed #6295
- Added
- Tabs
- Added
tab-position
attribute #6096
- Added
- Radio
- Added
border
andsize
attributes #6690
- Added
- Checkbox
- Added
border
andsize
attributes #6690
- Added
- Alert
- Added
center
attribute so that the content can be centered #6876
- Added
- Menu
- Form
- Added
inline-message
attribute to determine if the validation message is displayed in inline style #7032 - Added
status-icon
attribute to display a feedback icon when validated #7032 - Form and FormItem now have a
size
attribute. Inner components will inherit this size if not specified on themselves, #7428 validate
method will now return a promise if the callback is omitted, #7405- Added
clearValidate
method for clearing validating results for all form items, #7623
- Added
- Input
- Added
suffix
andprefix
named slots,suffixIcon
andprefixIcon
attributes to add contents inside the input box #7032
- Added
- Breadcrumb
- Added
separator-class
attribute to support icons as item separators #7203
- Added
- Steps
- Added
simple
attribute to activate simple-styled Steps #7274
- Added
- Pagination
- Added
prev-text
andnext-text
attributes to customize texts of previous page and next page #7005
- Added
- Loading
- Now you can customize spinner icon and background color with
spinner
andbackground
prop, #7390
- Now you can customize spinner icon and background color with
- Autocomplete
- Added
debounce
attribute, #7413
- Added
- Upload
- Added
limit
andon-exceed
attributes to limit the amount of files, #7405
- Added
- DateTimePicker
- Added
time-arrow-control
attribute to activatearrow-control
of the nesting TimePicker, #7438
- Added
- Layout
- Added a new breakpoint
xl
for viewport wider than 1920px
- Added a new breakpoint
- Table
- Added
span-method
attribute for merging cells - Added
clearSort
method to clear sorting programmatically - Added
clearFilter
method to clear filter programmatically - For expandable rows, when a row is expanded, a
.expanded
class will be added to its class list, so that you can customize its style - Added
size
attribute - Added
toggleRowExpansion
method to expand or collapse expandable rows programmatically - Added
cell-class-name
attribute to assign class name for cells - Added
cell-style
attribute to style cells - Added
header-row-class-name
attribute to assign class name for header rows - Added
header-row-style
attribute to style header rows - Added
header-cell-class-name
attribute to assign class name for header cells - Added
header-cell-style
attribute to style header cells - TableColumn's
prop
attribute now acceptsobject[key]
notations - Added
index
attribute for TableColumn to customize row indices
- Added
- Select
- Added
reserve-keyword
attribute for reserving current search keyword after selecting an option
- Added
Bug fixes
- DatePicker
- DateTimePicker
- TimePicker
- Fixed
v-model
not update correctly when blurred #6023
- Fixed
- Dialog
- Fixed texts having blurry edges when opening and closing nesting dropdowns #6088
- Select
- Improved performance. Now Vue dev-tool won't crash when a large number of Selects are destroyed #6151
- Table
- Fixed a bug that Table remains hiding when its parent element appears from
display: none
- Fixed Table expanding its width when its parent element has
display: flex
- Fixed a bug that fixed columns of a Table with
append
slot would disappear when data is dynamically fetched - Fixed
expand-row-keys
attribute not working with initial value - Fixed filter failing when
data
updates - Fixed a calculation error of fixed columns layout with grouped headers
- Fixed a dynamic
max-height
bug - Fixed some style calculation errors
- Fixed a bug that Table remains hiding when its parent element appears from
Breaking changes
- General
- Removed
theme-default
- Compatible with Vue 2.5.2+ and IE 10+
change
event of form components andcurrent-change
event of Pagination now only trigger on user interactionsize
attribute of Button and form components now acceptmedium
,small
andmini
- To facilitate the use of third-party icons,
icon
attribute of Button and Steps,prefix-icon
andsuffix-icon
attributes of Input now require a full class name
- Removed
- Dialog
- Removed
size
attribute. Now the size of Dialog can be configured bywidth
andfullscreen
- Now the visibility of Dialog cannot be controlled by
v-model
- Removed
- Rate
text-template
is renamed toscore-template
- Dropdown
menu-align
is renamed toplacement
. Now it supports more positions
- Transfer
footer-format
is renamed toformat
- Switch
- Attributes starting with
on-*
will be parsed to events in JSX, making allon-*
attributes of Switch not
able to work in JSX. Soon-*
attributes are renamed toactive-*
, and accordinglyoff-*
attributes are renamed toinactive-*
. This change affects the following attributes:on-icon-class
,off-icon-class
,on-text
,off-text
,on-color
,off-color
,on-value
,off-value
active-text
andinactive-text
attributes now don't have default values
- Attributes starting with
- Tag
type
attribute now acceptssuccess
,info
,warning
anddanger
- Menu
- Removed
theme
attribute. The color of Menu can be configured usingbackground-color
,text-color
andactive-text-color
- Removed
- Input
- Removed
icon
attribute. Now the suffix icon can be configured usingsuffix-icon
attribute orsuffix
named slot - Removed
on-icon-click
attribute andclick
event. Now to add click handler on icons, please use named slots change
event now behaves like the native input element, which triggers only on blur or pressing enter. If you need to respond to user input in real time, you can useinput
event.
- Removed
- Autocomplete
- Removed
custom-item
attribute. Now the template of input suggestions can be customized usingscoped slot
- Removed
props
attribute. Now you can usevalue-key
attribute to designate key name of the input suggestion object for display
- Removed
- Steps
- Removed
center
attribute - Now the Steps will fill its parent container by default
- Removed
- DatePicker
- The params of DatePicker's
change
event is now the binding value itself. Its format is controlled byvalue-format
- The params of DatePicker's
- Table
- Removed support for customizing column template using
inline-template
sort-method
now aligns withArray.sort
. It should return a number instead of a booleanappend
slot is moved outside thetbody
element to avoid multiple renderingexpand
event is renamed toexpand-change
- The params of
row-class-name
androw-style
method is now an object
- Removed support for customizing column template using
* Dynamically rendering arbitrary HTML on your website can be very dangerous because it can easily lead to XSS attacks. So when dangerouslyUseHTMLString
is on, please make sure the content of message
is trusted, and never assign message
to user-provided content.