vue零基础开发022——Vue中的CSS动画原理
作者:
文朝明 | 来源:发表于
2019-11-29 17:06 被阅读0次<html>
<head>
<meta charset="utf-8" />
<title>Vue中的CSS动画原理</title>
<script src="./vue.js"></script>
<style>
.fade-enter {
opacity: 0
}
.fade-enter-active {
transition: opacity 3s;
}
.fade-leave-to {
opacity: 0
}
.fade-leave-active {
transition: opacity 3s;
}
</style>
</head>
<body>
<div id="root">
<transition name="fade">
<div v-if="show">hello world</div>
</transition>
<button @click="handleClick">切换</button>
</div>
<script>
var vm = new Vue({
el: "#root",
data: {
show: true
},
methods: {
handleClick: function () {
this.show = !this.show
}
}
})
</script>
</body>
</html>
transition
本文标题:vue零基础开发022——Vue中的CSS动画原理
本文链接:https://www.haomeiwen.com/subject/uaugwctx.html
网友评论