☝️ Breaking Change List
zazzaz opened this issue · comments
Here is the list of breaking changes from Element 2.x to Element Plus
This issue is outdated, please see
本 issue 已过时,请查看以下
Time Picker
Attributes
-
Delete picker-options option (Move to top-level options separately)
-
Delete picker-options.format (Use the only picker format)
-
Delete picker-options.selectableRange (New selectableRange API )
5. Delete value-format option, out-put binding value will always be a Date Object, usedayjs(value).format()
instead -
Add disabledHours(for range picker type start | end) disabledMinutes disabledSeconds APIs
Doc
Update editable description (prevent mobile device virtual keyboard)
6. remove is-range, and export saparate component
TimePicker TimeRangePicker
Timeline
Attributes
- Delete reverse (You should update data to reverse time-line,not bind props reverse)
Tooltip
Attributes
- popperOptions: since we have replaced the previous version to
@popperjs/core
v2, the popperOptions are completely different from v1.
--- popper.js parameters
+++ once the user has provided this option, the popper is under the user's control, `Popper` will not initialize `popper` from the default options anymore, all attributes such as `offset` will not be effective
- offset
--- default: 0
+++ default: 12
Popconfirm
Attributes
- event onConfirm is replaced by confirm
- event onCancel is replaced by cancel
Calendar
Attributes
- value / v-model Date Object only
- range Date Object only, do not have to be start day of week / end day of week
- remove first-day-of-week, use Day.js locale instead
- slot data add date (JS Date)
Doc
Set Global Day.js locale in Doc site
How to set Day.js locale
Date Picker
Attributes
- remove first-day-of-week, use Day.js locale instead
- Delete picker-options option (Move to top-level options separately)
- Add shortcut option, change accepted values [{text, value}]
- Add disabledDate option
- defaultTime option accept Date object
Doc
Update editable description
6. remove type
, and export saparate component
Date(s)Picker(time) - DateRangePicker(time)
MonthPicker - MonthRangePicker
WeekPicker
YearPicker
Form
- validate now returns a promise that reject invalidFields instead of a single boolean if no callback is provided.
- the library now assumes Promise is always available and users should provide a sensible polyfill if they need ever to support deprecate browsers at all.
Locale
- Default language English
- Locale file name in lower case
- setting locale vie Locale-Provider
TimePicker
Attributes
- Delete picker-options option (Move to top-level options separately)
Date Picker
Attributes
1. remove first-day-of-week, use Day.js locale instead 2. Delete picker-options option (Move to top-level options separately) 3. Add shortcut option, change accepted values [{text, value}] 4. Add disabledDate option 5. defaultTime option accept Date object 6. remove `type`, and export saparate component
Date(s)Picker(time) - DateRangePicker(time)
MonthPicker - MonthRangePicker
WeekPicker
YearPickerDoc
Update editable description
there should be an example about how to set locale on Day.js which may affect element-plus as metioned。
Time Picker
Attributes
- Delete picker-options option (Move to top-level options separately)
- Delete picker-options.format (Use the only picker format)
- Delete picker-options.selectableRange (New selectableRange API )
- Delete value-format option, out-put binding value will always be a Date Object
- emove is-range, and export saparate component
TimePicker TimeRangePicker
- Add disabledHours(for range picker type start | end) disabledMinutes disabledSeconds APIs
Doc
Update editable description (prevent mobile device virtual keyboard)
Attributes “value-format” ,has it been cancelled? how to format values?
Time Picker
Attributes
- Delete picker-options option (Move to top-level options separately)
- Delete picker-options.format (Use the only picker format)
- Delete picker-options.selectableRange (New selectableRange API )
- Delete value-format option, out-put binding value will always be a Date Object
- emove is-range, and export saparate component
TimePicker TimeRangePicker
- Add disabledHours(for range picker type start | end) disabledMinutes disabledSeconds APIs
Doc
Update editable description (prevent mobile device virtual keyboard)
In demo code, there is still 'is-range' and works correctly. It seems that the summary has some mistake. Will there be a comprehensive and accurate migration guide in the near future?
Popconfirm
Attributes
- event onConfirm is replaced by confirm
- event onCancel is replaced by cancel
there seems does not change.
Timeline
Attributes
- Delete reverse (You should update data to reverse time-line,not bind props reverse)
can we achieve reverse by judging the vnode type and its children? Anyway, keeping functions stable is good for elementui users
In the demo code, there is still 'is-range' and works correctly. It seems that the summary has some mistakes. Will there be a comprehensive and accurate migration guide in the near future?
@attacking The split component plan is canceled and deleted above, cause this will increase a huge bundle size.
there should be an example about how to set locale on Day.js which may affect element-plus as metioned。
@edsolater Yes, updated here #1096
Since before this PR #1354, the API is kind of confusing, for instance:
show-after
indicates when the trigger event occurred, tooltip
and popover
will appear after show-after
time.
But hide-after
indicates the tooltip
popover
should be auto closed after hide-after
time.
In this PR we adjust the semantics for hide-after
which means after hide-after
time the popups should be disappear from the screen. Also a new API auto-close
for indicating closing the popups after auto-close
time popups right after show
event occurred.
So here is the API changes #1354
Tooltip Popover PopConfirm
open-delay
changed toshow-after
close-delay
changed tohide-after
hide-after
changed toauto-close
[Vue warn]: Failed to resolve component: el-affix
[Vue warn]: Failed to resolve component: el-affix
Please DO NOT REPORT ISSUES HERE, open an individual one with specific description, thank you very much.
Dialog
-
visible
change tov-model
Theme-chalk
- add
$--colors
as root color map $--color-primary-light-1
change to- sass:
map.get($--colors, 'primary', 'light-1')
- css:
var(--el-color-primary-light-1)
- sass:
Similar $--color-success-light
/ $--color-warning-lighter
.
Form
float
layout changed toflex
layout.
Row
float
layout changed toflex
layout.- Remove prop
type="flex"
.
Menu
- When menu is horizontal and too long to show, the overflow will be added to a sub menu. (default enabled) #3870
Theme-chalk
-background-color
->-bg-color
-font-color
->-text-color
Example:
$--button-font-color
will change to$--button-text-color
$--button-background-color
will change to$--button-bg-color
Similiar to tailwindcss
Build
- Remove
packages
in npm - For webpack 4, please refer to vueuse/vueuse#718 (comment)
/index
must be added to the end of path likeelement-plus/es/components/button/style
->element-plus/es/components/button/style/index
- Remove ResizeObserver polyfill.
cc @adaex @YunYouJun Could you guys please add the breaking change for icon-font
in here?
Deprecation of FontIcon
Font Icon was replaced with Inline Vue SVG component. #3492
Before
<template>
<el-button type="primary" icon="el-icon-search">Search</el-button>
</template>
After
After this change, you can use the icon
attribute to add icon. You can pass either string for the component name (registered in advance) or the component itself which is a SVG Vue component. Element Plus has provided a set of icon that you can find at icon.
<script setup lang="ts">
import { Search } from '@element-plus/icons'
</script>
<template>
<el-button type="primary" :icon="Search">Search</el-button>
</template>
You can pass down a Vue component for getting one of your desired icon, it dramatically increased the scalability for all components with icons, you can also apply actions to your Vue component, for example:
<script setup>
import { MyIcon } from 'some/icon/lib'
</script>
<template>
<el-button :icon="MyIcon"></el-button>
</template>
You can checkout the table below to know the API changes
Component Name | API before change | API after change |
---|---|---|
Avatar | icon (string) | icon (string / Component) |
Button | icon (string) | icon (string / Component) |
DatePicker | prefix-icon (string) | prefix-icon (string / Component) |
DatePicker | clear-icon (string) | clear-icon (string / Component) |
Input | prefix-icon (string) | prefix-icon (string / Component) |
Input | suffix-icon (string) | suffix-icon (string / Component) |
MessageBox | icon-class (string) | icon (string / Component) |
Message | icon-class (string) | icon (string / Component) |
Notification | icon-class (string) | icon (string / Component) |
PageHeader | icon (string) | icon (string / Component) |
Select | clear-icon (string) | clear-icon (string / Component) |
VirtualizedSelect | clear-icon (string) | clear-icon (string / Component) |
TimePicker | prefix-icon (string) | prefix-icon (string / Component) |
TimePicker | clear-icon (string) | clear-icon (string / Component) |
TimeSelect | prefix-icon (string) | prefix-icon (string / Component) |
TimeSelect | clear-icon (string) | clear-icon (string / Component) |
Timeline | icon (string) | icon (string / Component) |
Tree | icon-class (string) | icon (string / Component) |
You can find more #4060.
移除全局配置 app.config.globalProperties.$ELEMENT | Remove global config app.config.globalProperties.$ELEMENT #4793
关于 app.config.globalProperties.$ELEMENT,也是从 Element UI 遗留下来的代码。使用 Vue 3 建议使用 inject 的方式去传递全局配置。新方式支持配置 reactive 可变。
About app.config.globalProperties.$ELEMENT, it is also the code left over from Element UI. With Vue 3, it is recommended to use inject to pass the global configuration. The new way supports reactive configuration.
This issue is outdated, please see