动画<transition>包裹的元素设置ID选择器就不生效
粉丝福利 : 关注VUE中文社区公众号,回复视频领取粉丝福利
包裹的元素设置class选择器有效果但是改成id选择器就不生效是Vue的BUG吗
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
#main {
width: 500px;
height: 500px;
border-radius: 50%;
background-color: yellow;
margin: 20px auto;
}
.v-enter,
.v-leave-to {
width: 10px;
height: 10px;
background-color: red;
border-radius: 0;
}
.v-enter-active,
.v-leave-active {
transition: all 3s;
}
</style>
</head>
<body>
<div id="app">
<button @click="show=!show">点我</button>
<transition>
<!-- 为啥用id动画就不生效呢????? class="main"就可以 -->
<div id="main" v-show="show"></div>
</transition>
</div>
<script src="lib/vue-2.4.0.js"></script>
<script>
const app=new Vue({
el:'#app',
data:{
show:false
},
methods:{
}
});
</script>
</body>
</html>`11