* docs(button): 更新按钮组件文档对开放能力的描述 - 修改 session-message-title 和 session-message-path 属性名称 - 新增 chooseavatar 和 agreeprivacyauthorization 事件回调 * docs(icon): 更新图标组件文档 - 调整属性描述,明确 name 属性可用于图标名称或图片链接 - 添加事件列表,明确 click 事件的参数 - 移除英文示例代码中不必要的示例和图标列表 - 优化文档结构和格式,使信息更加清晰 * docs(config-provider): 更新全局配置组件文档 - 调整文档中的强调样式,使用加粗替代下划线 - 完善英文文档缺失的内容,保持和中文文档一致 * docs(component): 更新 Popup 组件文档 - 调整文档结构,优化标题层级 - 添加 v-model 使用示例,明确组件绑定值 - 移除冗余的代码示例,精简文档内容 - 更新属性表格,统一属性描述 - 添加防止滚动穿透的解决方案说明 * docs(resize): ✏️ 更新 resize 组件文档 - 修正事件名称从 `size` 改为 `resize` - 添加组件属性(Attributes)、事件(Events)和插槽(Slots)的详细说明 - 更新文档结构,使其更加完整和易于理解 * docs(transition): ✏️完善Transition 动画组件文档的属性和事件描述 - 增加自定义根节点样式类、懒渲染、动画结束后销毁子节点等属性 - 添加进入和离开过渡的开始、激活和结束状态类 - 新增点击事件和默认插槽 - 更新文档以反映新增功能 * docs(fab): ✏️更新fab组件文档 - 优化了文档结构,调整了部分格式 - 添加了 Methods 和 default Slot 相关的信息 - 更新了 custom-style 属性的命名 * docs(component): ✏️ 更新 Text 组件文档 - 优化文档格式,调整表格结构 - 添加缺失的参数说明和示例代码 - 更新参数类型和默认值 - 增加 call 参数说明 - 补充 Slots 表格 * docs(root-portal): ✏️ 更新组件文档 - 添加 Attributes 和 Events 部分,说明该组件无相关配置 - 修正 Slots 部分的版本信息,统一为 1.11.0 - 更新中文和英文文档
7.1 KiB
Transition
Used to apply transition effects when elements enter or leave.
Basic Usage
Wrap elements in the wd-transition tag, set show to toggle visibility, and set name to choose the animation.
<wd-transition :show="show" name="fade">Content</wd-transition>
Animation Types
wd-transition has built-in common animations such as fade, slide, zoom-in, etc.
<wd-transition :show="show" name="slide">Content</wd-transition>
Animation Duration
You can set the animation execution time through duration. The animation is split into enter animation and leave animation. duration can set the execution time for both enter and leave animations separately: { enter: 300, leave: 500 }.
Custom Animation
You can set custom animation class names through enter-class, enter-active-class, enter-to-class, leave-class, leave-active-class, leave-to-class.
When the animation enters, the tag will be set with enter-class and enter-active-class styles, and in the next frame, it will switch to enter-to-class and enter-active-class styles. Therefore, the enter animation transitions from the enter-class style to the enter-to-class style state, with enter-active-class setting the transition related properties.
When the animation leaves, the tag will be set with leave-class and leave-active-class styles, and in the next frame, it will switch to leave-to-class and leave-active-class styles. Therefore, the leave animation transitions from the leave-class style to the leave-to-class style state, with leave-active-class setting the transition related properties.
<wd-transition
:show="customShow"
:duration="{ enter: 700, leave: 1000 }"
enter-class="custom-enter"
enter-active-class="custom-enter-active"
enter-to-class="custom-enter-to"
leave-class="custom-leave"
leave-active-class="custom-leave-active"
leave-to-class="custom-leave-to"
custom-class="block"
/>
:deep(button) {
margin: 0 10px 10px 0;
}
:deep(.block) {
position: fixed;
left: 50%;
top: 50%;
margin: -50px 0 0 -50px;
width: 100px;
height: 100px;
background: #0083ff;
}
:deep(.custom-enter-active),
:deep(.custom-leave-active) {
transition-property: background, transform;
}
:deep(.custom-enter) {
transform: translate3d(-100px, -100px, 0) rotate(-180deg);
background: #ff0000;
}
:deep(.custom-leave-to) {
transform: translate3d(100px, 100px, 0) rotate(180deg);
background: #ff0000;
}
Attributes
| Parameter | Description | Type | Optional Values | Default Value | Minimum Version |
|---|---|---|---|---|---|
| show | Whether to display the component | boolean | - | - | - |
| name | Animation type | string / array | TransitionName |
- | - |
| duration | Animation duration | number / object / boolean | - | 300(ms) | - |
| custom-style | Custom styles | string | - | - | - |
| custom-class | Custom root node style class | string | - | - | - |
| lazy-render | Lazy render content | boolean | - | false | - |
| destroy | Whether to destroy child nodes after animation ends | boolean | - | true | - |
| enter-class | Starting state of enter transition | string | - | - | - |
| enter-active-class | Active state of enter transition | string | - | - | - |
| enter-to-class | Ending state of enter transition | string | - | - | - |
| leave-class | Starting state of leave transition | string | - | - | - |
| leave-active-class | Active state of leave transition | string | - | - | - |
| leave-to-class | Ending state of leave transition | string | - | - | - |
| disable-touch-move | Whether to prevent touch scrolling | boolean | - | false | 1.11.0 |
TransitionName Animation Types
| Name | Description | Minimum Version |
|---|---|---|
| fade | Fade in and out | - |
| fade-down | Fade down | - |
| fade-left | Fade left | - |
| fade-right | Fade right | - |
| fade-up | Fade up | - |
| slide-down | Slide down | - |
| slide-left | Slide left | - |
| slide-right | Slide right | - |
| slide-up | Slide up | - |
| zoom-in | Zoom in | - |
| zoom-out | Zoom out | - |
Events
| Event Name | Description | Parameters | Version |
|---|---|---|---|
| before-enter | Triggered before enter | - | - |
| enter | Triggered during enter | - | - |
| after-enter | Triggered after enter | - | - |
| before-leave | Triggered before leave | - | - |
| leave | Triggered during leave | - | - |
| after-leave | Triggered after leave | - | - |
| click | Triggered when clicked | - | - |
Slots
| Slot Name | Description | Version |
|---|---|---|
| default | Content to apply animation effects | - |
External Style Classes
| Class Name | Description | Version |
|---|---|---|
| custom-class | Root node style | - |
| enter-class | Defines the starting state of the enter transition, takes effect before the element is inserted, removed in the next frame | - |
| enter-active-class | Defines the state during animation execution, applied throughout the enter animation; takes effect before the element is inserted, removed after the animation ends; can define transition-related properties | - |
| enter-to-class | Defines the ending state of the enter transition, takes effect in the next frame after the element is inserted, removed after the animation ends | - |
| leave-class | Defines the starting state of the leave transition, takes effect immediately when the leave animation is triggered, removed in the next frame | - |
| leave-active-class | Defines the state during animation execution, applied throughout the leave animation; takes effect immediately when the leave animation is triggered, removed after the animation ends; can define transition-related properties | - |
| leave-to-class | Defines the ending state of the leave transition, takes effect in the next frame when the leave animation is triggered, removed after the animation ends | - |