Element Plus Breaking Changes (English version) #5658
sxzz
announced in
Documentation
Replies: 3 comments 7 replies
-
Thank you for making this list 😃 |
Beta Was this translation helpful? Give feedback.
1 reply
-
i am also interested in dark/light theme switch |
Beta Was this translation helpful? Give feedback.
1 reply
-
if i still use element-plus-v1-beta,where can i find the document?now the document on the official webside is about v2,and i can switch the version~ |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This documentation will list breaking changes with Element UI 2.x.
Dev Environment
Vue CLI
If you use Vue CLI as your build tool, please upgrade to latest version, both v4 and v5 are acceptable.
Webpack 4
If you use Webpack 4 as your build tool, please consider the code below.
Webpack 5
If you use Webpack 5 as your build tool, please consider the code below.
Compatibility
The table below shows the minimum browser requirements for Element Plus.
If you want to use Element Plus normally on lower version browsers, please manually use Babel, ESBuild or other transform tools and import corresponding polyfills.
It is worth noting that Element Plus uses
ResizeObserver
, you need to import resize-observer-polyfill. For details, see ResizeObserver Compatibility. Please refer to the documentation for more details.Font Icon Removed
Class name based Font Icon has been removed, which means you need to migrate all
el-icon-
related code to SVG Font, and please refer to the comparison table below. For more details about SVG icons, you can refer to documentation. You can also use the unplugin-icons plugin for automatic import.Element UI
Element Plus
Release Package
The source code
/packages
of Element Plus has been removed in the npm release package. If you need, please copy the source code yourself.Install
Import
The import path of Element Plus is different from that of Element UI. Please consider the code below. For more methods, please refer to Installation Documentation
Global Configuration
Global configuration
Vue.prototype.$ELEMENT
has been removed, please consider the code below.Or use config-provider component, please consider the code below.
Design
The component size system is switched from default / medium / small / mini to large / default / small.
default
will be the default size, uselarge
if you need to increase it, or usesmall
to reduce the size. In terms of Padding, it is optimized to a more general 4px system, using 4/8 px as the atomic unit to control the padding consistency of the entire system. That is, the padding of large components is also large, and the padding of small components is also small.The main components involved are Button, Radio, Checkbox, Input, Select, DatePicker, Form, Table, Tag, and other components with size properties.
It mainly involves attributes such as padding and margin attribute modification, font-size and other font and icon size modification, etc.
Custom Theme
Sass
In the
.scss
file, import all styles:Due to the scope of
@use
, when using a variable, you need to export it, or forward the variable through@forward
. For example:'\*'
means no namespace, it can also be named.Forward app variables via the
@forward
syntax:Variable
-background-color
->-bg-color
-font-color
->-text-color
The variable name naming will be similar to the variable naming in tailwindcss.
The variables of each component are organized using
@use 'sass:map';
, and the variables of the corresponding component are moved to the corresponding component name.See
element-plus/theme-chalk/src/common/var.scss
for exposed variables.For example, the default variable for the
switch
component is:User-defined variables: (will automatically override and merge default variables)
For more details, please refer to Custom theme.
Internationalization
Element Plus uses English as the default language. To change the default language, please refer to the Global Configuration section and set the
locale
property.For more details, please refer to documentation.
Component
Since Vue 3 changed the property name of
v-model
fromvalue
tomodel-value
, if you use thevalue
property, please change it tomodel-value
(v-model
no special The description does not need to be modified), and will not be repeated later.Layout
Row
type
Dialog
visible
model-value
/v-model
Menu
ElSubmenu
/el-submenu
ElSubMenu
/el-sub-menu
Popconfirm
on-confirm
confirm
2.14.0
on-cancel
cancel
2.14.0
Timeline
reverse
Date Picker / Time Picker / DateTime Picker
picker-options
picker-options.format
format
picker-options.selectableRange
disabled-hours
/disabled-minutes
/disabled-seconds
first-day-of-week
default-time
Date
objects are supportedTooltip
popper-options
this property is completely different from v1.
See popperjs documentation.
offset
0
to12
open-delay
show-after
close-delay
hide-after
hide-after
auto-close
Calendar
value
model-value
/v-model
range
first-day-of-week
Popover
open-delay
show-after
close-delay
hide-after
hide-after
auto-close
Scrollbar
wrap
wrap$
Form
float layout has been changed to flex layout.
validate
Promise
ofreject
, no longerfalse
For more details about features and breaking changes, please see this (in Chinese)
Templates
The following is a quick start template, I believe it will help you.
Beta Was this translation helpful? Give feedback.
All reactions