fix-window.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <template>
  2. <view class="fix-window">
  3. <top-window class="fix-window-top"/>
  4. <view class="fix-window-button" @click="tiggerWindow"></view>
  5. <view v-show="visible" class="fix-window--mask" @click="tiggerWindow"></view>
  6. <left-window v-show="visible" class="fix-window--popup" />
  7. </view>
  8. </template>
  9. <script>
  10. import topWindow from '../../windows/topWindow.vue'
  11. import leftWindow from '../../windows/leftWindow.vue'
  12. export default {
  13. components:{
  14. topWindow,
  15. leftWindow
  16. },
  17. data() {
  18. return {
  19. visible: false
  20. };
  21. },
  22. methods: {
  23. tiggerWindow() {
  24. this.visible = !this.visible
  25. }
  26. }
  27. }
  28. </script>
  29. <style>
  30. .fix-window {
  31. }
  32. .fix-window-button {
  33. width: 30px;
  34. height: 30px;
  35. opacity: 0.5;
  36. position: fixed;
  37. top: 40px;
  38. left: 20px;
  39. z-index: 999;
  40. }
  41. .fix-window-top {
  42. width: 100%;
  43. position: fixed;
  44. top: 25px;
  45. left: 0;
  46. z-index: 999;
  47. }
  48. .fix-window--mask {
  49. position: fixed;
  50. bottom: 0px;
  51. top: 25px;
  52. left: 0px;
  53. right: 0px;
  54. background-color: rgba(0, 0, 0, 0.4);
  55. transition-duration: 0.3s;
  56. z-index: 997;
  57. }
  58. .fix-window--popup {
  59. position: fixed;
  60. top: 85px;
  61. left: 0;
  62. /* transform: translate(-50%, -50%); */
  63. transition-duration: 0.3s;
  64. z-index: 998;
  65. }
  66. </style>