Skip to content

Commit b449705

Browse files
committed
refactor to avoid high cpu usage on transitions page, fixes vuejs#945
1 parent ffb8af1 commit b449705

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

src/v2/guide/transitions.md

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1520,7 +1520,7 @@ Really though, any transition attribute can be dynamically bound. And it's not j
15201520
``` html
15211521
<script src="https://cdnjs.cloudflare.com/ajax/libs/velocity/1.2.3/velocity.min.js"></script>
15221522

1523-
<div id="dynamic-fade-demo">
1523+
<div id="dynamic-fade-demo" class="demo">
15241524
Fade In: <input type="range" v-model="fadeInDuration" min="0" v-bind:max="maxFadeDuration">
15251525
Fade Out: <input type="range" v-model="fadeOutDuration" min="0" v-bind:max="maxFadeDuration">
15261526
<transition
@@ -1531,7 +1531,14 @@ Really though, any transition attribute can be dynamically bound. And it's not j
15311531
>
15321532
<p v-if="show">hello</p>
15331533
</transition>
1534-
<button v-on:click="stop = true">Stop it!</button>
1534+
<button
1535+
v-if="stop"
1536+
v-on:click="stop = false; show = false"
1537+
>Start animating</button>
1538+
<button
1539+
v-else
1540+
v-on:click="stop = true"
1541+
>Stop it!</button>
15351542
</div>
15361543
```
15371544

@@ -1543,7 +1550,7 @@ new Vue({
15431550
fadeInDuration: 1000,
15441551
fadeOutDuration: 1000,
15451552
maxFadeDuration: 1500,
1546-
stop: false
1553+
stop: true
15471554
},
15481555
mounted: function () {
15491556
this.show = false
@@ -1595,7 +1602,14 @@ new Vue({
15951602
>
15961603
<p v-if="show">hello</p>
15971604
</transition>
1598-
<button v-on:click="stop = true">Stop it!</button>
1605+
<button
1606+
v-if="stop"
1607+
v-on:click="stop = false; show = false"
1608+
>Start animating</button>
1609+
<button
1610+
v-else
1611+
v-on:click="stop = true"
1612+
>Stop it!</button>
15991613
</div>
16001614
<script>
16011615
new Vue({
@@ -1605,7 +1619,7 @@ new Vue({
16051619
fadeInDuration: 1000,
16061620
fadeOutDuration: 1000,
16071621
maxFadeDuration: 1500,
1608-
stop: false
1622+
stop: true
16091623
},
16101624
mounted: function () {
16111625
this.show = false

0 commit comments

Comments
 (0)