You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/guide/transitions.md
+28-30Lines changed: 28 additions & 30 deletions
Original file line number
Diff line number
Diff line change
@@ -3,27 +3,27 @@ type: guide
3
3
order: 12
4
4
---
5
5
6
-
With Vue.js' transition system you can apply automatic transition effects when elements are inserted into or removed from the DOM. There are two options to do so: defining CSS classes with transitions/animations, or by registering a definition object containing custom JavaScript hook functions.
With the directive `v-transition="my-transition"` applied, Vue will:
8
+
通过使用`v-transition="my-transition"`指令的运用,Vue将会:
9
9
10
-
1.Try to find a JavaScript transtion definition registered either through `Vue.transition(id, def)` or passed in with the `transitions` option, with the id `"my-transition"`. If it finds it, it will use that definition object to perform the custom JavaScript based transition.
2.If no custom JavaScript transition is found, it will automatically sniff whether the target element has CSS transitions or CSS animations applied, and add/remove the CSS classes at the appropriate times.
3.If no transitions/animations are detected, the DOM manipulation is executed on next frame.
14
+
3.如果没有检测到过渡/动画,那么就会在下一帧直接执行DOM操作
15
15
16
-
<pclass="tip">All Vue.js transitions are triggered only if the DOM manipulation was applied by Vue.js, either through built-in directives, e.g. `v-if`, or through Vue instance methods, e.g. `vm.$appendTo()`.</p>
You also need to define CSS rules for `.expand-enter`and`.expand-leave` classes:
26
+
你需要给`.expand-enter`和`.expand-leave`定义CSS规则:
27
27
28
28
```css
29
29
.msg {
@@ -65,28 +65,28 @@ new Vue({
65
65
})
66
66
</script>
67
67
68
-
The classes being toggled are based on the value of your `v-transition` directive. In the case of `v-transition="fade"`, the classes being toggled will be `.fade-enter` and `.fade-leave`. When no value is provided they will default to `.v-enter` and `.v-leave`.
CSS animations are applied in the same way with CSS transitions, the difference being that `v-enter` is not removed immediately after the element is inserted, but on an `animationend` callback.
0 commit comments