vue过度官方文档地址:
    https://cn.vuejs.org/v2/guide/transitions.html#%E5%88%97%E8%A1%A8%E8%BF%87%E6%B8%A1

    1. <template>
    2. <div class="detail-middle-history-flv">
    3. <transition name="rightToLeft" >
    4. <div class="innerContainerHistory" v-show="isClose">
    5. <div class="cameraList-box" v-if="videolist.length >4">
    6. <div class="cameraList-title" @click="handleShowCamer">摄像头</div>
    7. <div class="item-box" v-if="isShowCamer">
    8. <p v-for="(item,index) in videolist" :key="index"
    9. @click="changeVideoUrl(item.url)"
    10. >摄像头{{index+1}}</p>
    11. </div>
    12. </div>
    13. <div class="player-box">
    14. <div >
    15. <video v-show="videolist.length > 0 " :class="{enlarge:enlarge && enlargeIndex === 0}" poster="../../../static/img/videoPoster.png" id="videoElement0" @dblclick="enlargeFn(0)" @click="startPlay(0)" autoplay muted></video>
    16. <div v-show="videolist.length == 0" class="videoNull">
    17. <span class="videoNullLabel">暂无视频源</span>
    18. </div>
    19. </div>
    20. <div>
    21. <video v-show="videolist.length > 1" poster="../../../static/img/videoPoster.png" :class="{enlarge:enlarge && enlargeIndex === 1}" id="videoElement1" @dblclick="enlargeFn(1)" @click="startPlay(1)" autoplay muted ></video>
    22. <div v-show="videolist.length <= 1" class="videoNull">
    23. <span class="videoNullLabel">暂无视频源</span>
    24. </div>
    25. </div>
    26. <div>
    27. <video v-show="videolist.length > 2" poster="../../../static/img/videoPoster.png" :class="{enlarge:enlarge && enlargeIndex === 2}" id="videoElement2" @dblclick="enlargeFn(2)" @click="startPlay(2)" autoplay muted></video>
    28. <div v-show="videolist.length <= 2" class="videoNull">
    29. <span class="videoNullLabel">暂无视频源</span>
    30. </div>
    31. </div>
    32. <div>
    33. <video v-show="videolist.length > 3" :class="{enlarge:enlarge && enlargeIndex === 3}" poster="../../../static/img/videoPoster.png" id="videoElement3" @dblclick="enlargeFn(3)" @click="startPlay(3)" autoplay muted ></video>
    34. <div v-show="videolist.length <= 3" class="videoNull">
    35. <span class="videoNullLabel">暂无视频源</span>
    36. </div>
    37. </div>
    38. </div>
    39. </div>
    40. </transition>
    41. <img v-show="!isClose && isCloseBtn" class="switch-icon flv_open" src="./../../../static/img/icon/flv_open.png" alt="" @click="handleSwitch" >
    42. <transition name="rightToLeftBtn" >
    43. <img v-show="isClose" class="switch-icon" src="./../../../static/img/icon/flv_close.png" alt="" @click="handleSwitch" >
    44. </transition>
    45. </div>
    46. </template>
    47. watch:{
    48. isClose(newVal,oldVal){
    49. //延迟显示flv_open.png
    50. if(newVal){
    51. this.isCloseBtn = false
    52. }else{
    53. setTimeout(() => {
    54. this.isCloseBtn = true
    55. },500)
    56. }
    57. }
    58. },
    1. .innerContainerHistory{
    2. overflow-x: hidden;
    3. }
    4. .rightToLeft-enter-active, .rightToLeft-leave-active {
    5. transition: all .5s;
    6. }
    7. .rightToLeft-leave-to{
    8. transform: translateX(100%)
    9. }
    10. .rightToLeft-enter{
    11. transform: translateX(100%);
    12. }
    13. .rightToLeftBtn-enter-active, .rightToLeftBtn-leave-active {
    14. transition: all .5s;
    15. }
    16. .rightToLeftBtn-leave-to{
    17. transform: translateX(6rem)
    18. }
    19. .rightToLeftBtn-enter{
    20. transform: translateX(6rem);
    21. }