init
This commit is contained in:
67
Html-Vue/Vue-动画.html
Normal file
67
Html-Vue/Vue-动画.html
Normal file
@@ -0,0 +1,67 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<style>
|
||||
@keyframes leftToRight {
|
||||
0% {
|
||||
transform: translateX(-100px);
|
||||
}
|
||||
50% {
|
||||
transform: translateX(-50px);
|
||||
}
|
||||
0% {
|
||||
transform: translateX(0px);
|
||||
}
|
||||
}
|
||||
.animation {
|
||||
animation: leftToRight 3s;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
<title>Document</title>
|
||||
<script src="https://unpkg.com/vue@next"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
//过度 ,动画
|
||||
const app = Vue.createApp({
|
||||
data(){
|
||||
return {
|
||||
animate:{
|
||||
animation:false
|
||||
}
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
handleClick(){
|
||||
this.animate.animation=!this.animate.animation
|
||||
}
|
||||
},
|
||||
|
||||
template: `
|
||||
<div>
|
||||
<div :class="animate">hello Vue</div>
|
||||
<button @click="handleClick">切换</button>
|
||||
</div>
|
||||
`
|
||||
|
||||
|
||||
});
|
||||
|
||||
const vm = app.mount('#root');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user