Vue动画封装
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="vue.js"> </script>
</head>
<body>
<section class="app">
<fade :showw="show">
<article >hi</article>
</fade>
<button @click="handle">Select</button>
</section>
<script>
Vue.component("fade", {
props:["showw"],
template: `<transition @before-enter="hanle"
@enter="handleenter"
@after-enter="after">
<slot v-if="showw"></slot>
</transition>`,
methods: {
hanle: function (el) {
el.style.color = "blue"
},
handleenter: function (el, done) {
setTimeout(() =>{
el.style.color= "green"
},2000)
setTimeout(() =>{
done()
},4000)
}
}
})
var vm = new Vue({
el:".app",
data: {
show: true
},
methods: {
handle: function () {
this.show = !this.show
}
}
})
</script>
</body>
封装待续
本人是一个技术爱好者
1.但是每个技术爱好者都是从萌新开始的
2.我所有的博文都是我各方资料查阅(看的比较乱比较杂,因为有些是群里讨论等等来源,无法辨别出处,所以我的文章都是没有写明出处,都是我个人消化后整理,)
3.但是没有经过我实践的我一般会标注
4.希望大家共同交流共同进步,指出我的不足 谢谢

浙公网安备 33010602011771号