Skip to content

Commit

Permalink
chore(demo): improve ExampleComponent
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Chau committed Apr 28, 2019
1 parent 1a486f2 commit 707c439
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
30 changes: 25 additions & 5 deletions docs-src/ExampleComponent.vue
@@ -1,11 +1,13 @@
<template>
<div class="example-component">
<span>&lt;I'm a component!</span>
<button class="button" @click="count < 10 && count++">+</button>
<button class="button" @click="count > 0 && count--">-</button>
<span class="counter">
<span v-for="n in count" :key="n">{{ char }}</span>
</span>
<br>
<button v-if="count < 14" class="button" @click="count < 14 && count++">+</button>
<button v-if="count > 0" class="button" @click="count > 0 && count--">-</button>
<br>
<transition-group tag="span" class="counter">
<span v-for="n in count" :key="n" class="char">{{ char }}</span>
</transition-group>
<span>/&gt;</span>
</div>
</template>
Expand Down Expand Up @@ -45,4 +47,22 @@ export default {
.counter {
font-weight: bold;
}
.char {
display: inline-block;
width: 32px;
text-align: center;
margin-top: 6px;
overflow: hidden;
&.v-enter-active,
&.v-leave-active {
transition: width .5s;
}
&.v-enter,
&.v-leave-to {
width: 0;
}
}
</style>
2 changes: 1 addition & 1 deletion docs-src/PageHome.vue
Expand Up @@ -164,7 +164,7 @@
{{ msg }}
</p>

<ExampleComponent char="=" />
<ExampleComponent char="鉁岋笍" />

<div class="close">
<a
Expand Down

0 comments on commit 707c439

Please sign in to comment.