【发布时间】:2020-11-03 07:35:34
【问题描述】:
我是 vue 新手,刚刚了解了 vue 转换。我正在尝试向上移动 div 并在单击 div 时扩大其宽度,但我还没有完全掌握过渡的概念。下面是我想要实现的图像和代码。
<template>
<div class="hello">
<transition name="slide">
<div class="meal__status">
<a @click="toggle = !toggle; move();" class="meal__status-wrap"></a>
</div>
</transition>
<div v-if="toggle" class="overlay"></div>
</div>
</template>
<script>
export default {
name: "HelloWorld",
data() {
return {
toggle: false
};
},
methods: {
move() {}
}
};
</script>
<style scoped>
.overlay {
background: rgba(0, 0, 0, 0.9);
width: 100%;
height: 100%;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
display: block;
text-align: center;
transition: opacity 500ms;
opacity: 1;
}
.meal__status-wrap {
background-color: #42b983;
height: 60px;
width: 70px;
display: block;
position: relative;
z-index: 99999;
}
</style>
这是代码沙箱https://codesandbox.io/s/awesome-matsumoto-7rlxb?file=/src/components/HelloWorld.vue的链接
【问题讨论】:
标签: javascript html css vue.js