Skip to content

Instantly share code, notes, and snippets.

@niconico25
Created February 27, 2019 10:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save niconico25/7bb0fb2ed1d46cb26f1de2965b4b992e to your computer and use it in GitHub Desktop.
Save niconico25/7bb0fb2ed1d46cb26f1de2965b4b992e to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
</head>
<body>
<div id="app">
<header>
<button v-on:click="show=!show">切り替え</button>
</header>
<div>
<!--
jpg ファイルは適宜ご用意ください。
-->
<transition appear>
<img v-if="show" src="./fig.jpg" v-cloak>
</transition>
<transition appear>
<img v-if="show" src="./fig.jpg">
</transition>
<transition>
<img v-if="show" src="./fig.jpg">
</transition>
</div>
</div>
<style type="text/css">
[v-cloak] {
display: none;
}
.v-enter-active, .v-leave-active {
transition: opacity 1s, transform 1s;
}
.v-enter, .v-leave-to {
opacity: 0;
transform: translateY(40px);
}
header {
text-align: right;
}
p {
font-size: 50px;
text-align: center;
}
img {
width: 200px;
}
</style>
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.7/dist/vue.js"></script>
<script>
app = new Vue({
el: '#app',
data: {
show: true,
},
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment