<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
.mask {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0,0,0,.8);
}
.product {
position: fixed;
bottom: 0;
left: 0;
right: 0;
height: 500px;
background: #eee;
}
.a-enter, .a-leave-to {
transform: translate(0, 100%);
}
.a-enter-to, .a-leave {
transform: translate(0, 0);
}
.a-enter-active, .a-leave-active {
transition: all 0.3s;
}
</style>
</head>
<body>
<div id="app">
<!-- <button @click="open">打开</button> -->
<button @click="show = true">打开</button>
<div class="mask" v-if="show"></div>
<transition name="a">
<div class="product" v-if="show">
<button @click="show = false">关闭</button>
</div>
</transition>
</div>
<script src="./vue.js"></script>
<script>
const app = new Vue({
el: '#app',
data: {
show: false
},
methods: {
open () {
this.show = true
}
}
})
</script>
</body>
</html>
vue_transition仿小米移动端底部滑出菜单选项
最新推荐文章于 2021-10-29 16:27:00 发布