RightForm.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <template>
  2. <transition name="translation">
  3. <div class="right-bar-container" v-if="isFormShow">
  4. <div class="form-util">
  5. <div class="close" @click="isFormShow=false"></div>
  6. </div>
  7. <div>
  8. <slot></slot>
  9. </div>
  10. </div>
  11. </transition>
  12. </template>
  13. <script>
  14. export default {
  15. name: 'RightForm',
  16. data() {
  17. return {
  18. isFormShow: false,
  19. };
  20. },
  21. methods: {
  22. showForm() {
  23. this.isFormShow = true;
  24. },
  25. },
  26. };
  27. </script>
  28. <style scoped>
  29. .right-bar-container{
  30. position: fixed;
  31. right: 0px;
  32. top: 0px;
  33. height: 100vh;
  34. width: 800px;
  35. box-shadow: 0 0 5px #BDC3C7;
  36. background: #FFFFFF;
  37. }
  38. .translation-enter-active,.translation-leave-active {
  39. transition: all 0.3s ease-out;
  40. }
  41. .translation-enter-from,
  42. .translation-leave-to {
  43. transform: translateX(800px);
  44. }
  45. .form-util{
  46. width: 80px;
  47. margin-left: auto;
  48. padding: 10px;
  49. display: flex;
  50. flex-direction: row;
  51. justify-content: center;
  52. align-items: center;
  53. }
  54. .form-util .close{
  55. width: 20px;
  56. height: 20px;
  57. cursor: pointer;
  58. background-position: center;
  59. background-repeat: no-repeat;
  60. background-size: 100% 100%;
  61. background-image: url("../assets/icon/close.svg");
  62. }
  63. </style>