您好,登錄后才能下訂單哦!
本文實(shí)例為大家分享了vue實(shí)現(xiàn)鼠標(biāo)經(jīng)過(guò)動(dòng)畫(huà)的具體代碼,供大家參考,具體內(nèi)容如下
詳細(xì)代碼:
<template> <div class="hello"> <h2>{{ msg }}</h2> <div class="box"> <div class="boxchilde" @mouseenter="flag=true" @mouseleave="flag=false"> <div :class="flag?'passing':''"></div> </div> </div> </div> </template> <script> export default { name: 'HelloWorld', data () { return { msg: 'Welcome to Your Vue.js App', flag:false } } } </script> <!-- Add "scoped" attribute to limit CSS to this component only --> <style scoped> .box{ width: 100%; height: 100%; } .boxchilde{ display: inline-block; margin: 20px; width: 200px; height: 400px; background-color: #ccc; border-radius: 5px; -webkit-transition: all 0.6s ease-in; -moz-transition: all 0.6s ease-in; -ms-transition: all 0.6s ease-in; -o-transition: all 0.6s ease-in; transition: all 0.6s ease-in; overflow: hidden; } .boxchilde:hover{ cursor: pointer; -webkit-transform: translate(0,-10px); -moz-transform: translate(0,-10px); -ms-transform: translate(0,-10px); -o-transform: translate(0,-10px); transform: translate(0,-10px); } .passing { width: 100%; height: 10px; border-top-left-radius: 5px; border-top-right-radius: 5px; background-color: red; animation: passing_4500 0.8s ease-in-out 0s 1 alternate forwards; transform-origin: 50% 50%; } @keyframes passing_4500 { 0% { transform:translateX(-100%); opacity:0 } 33.33333% { transform:translateX(-100%); opacity:0 } 66.66667% { transform:translateX(0%); opacity:1 } 100% { transform:translateX(0%); opacity:1 } } </style>
更多關(guān)于Vue的精彩專(zhuān)題點(diǎn)擊下方查看:
Vue.js組件學(xué)習(xí)教程
Vue.js實(shí)戰(zhàn)教程
Vue.js前端組件學(xué)習(xí)教程
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持億速云。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀(guān)點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。