RightForm.vue 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. // 父组件通过ref的方式调用该方法显示表单
  23. showForm() {
  24. this.isFormShow = true;
  25. },
  26. },
  27. };
  28. </script>
  29. <style scoped>
  30. .right-bar-container{
  31. position: fixed;
  32. right: 0px;
  33. top: 0px;
  34. height: 100vh;
  35. width: 800px;
  36. box-shadow: 0 0 5px #BDC3C7;
  37. background: #FFFFFF;
  38. z-index: 101;
  39. }
  40. .translation-enter-active,.translation-leave-active {
  41. transition: all 0.3s ease-out;
  42. }
  43. .translation-enter-from,
  44. .translation-leave-to {
  45. transform: translateX(800px);
  46. }
  47. .form-util{
  48. width: 80px;
  49. margin-left: auto;
  50. padding: 10px;
  51. display: flex;
  52. flex-direction: row;
  53. justify-content: center;
  54. align-items: center;
  55. }
  56. .form-util .close{
  57. width: 20px;
  58. height: 20px;
  59. cursor: pointer;
  60. background-position: center;
  61. background-repeat: no-repeat;
  62. background-size: 100% 100%;
  63. background-image: url("../assets/icon/close.svg");
  64. }
  65. </style>