drawer.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <template>
  2. <view :class="['side-nav',{'right':direction == 'right'},{'left':direction == 'left'},{'show':show}]">
  3. <view class="item">
  4. <view class="body">
  5. <slot />
  6. </view>
  7. </view>
  8. </view>
  9. </template>
  10. <script>
  11. import {
  12. mapState
  13. } from 'vuex';
  14. export default {
  15. props: {
  16. show: {
  17. type: Boolean,
  18. default: false
  19. },
  20. direction: {
  21. type: String,
  22. default: 'right'
  23. }
  24. },
  25. data() {
  26. return {}
  27. },
  28. onLoad() {
  29. },
  30. methods: {
  31. month() {
  32. this.$emit('month');
  33. },
  34. }
  35. }
  36. </script>
  37. <style lang="less">
  38. /* flex */
  39. .flex-box {
  40. display: flex;
  41. flex-wrap: wrap;
  42. }
  43. .flex-box>.item-2 {
  44. flex: 0 0 50%;
  45. }
  46. .side-nav {
  47. position: fixed;
  48. z-index: 99;
  49. right: 0;
  50. top: 180upx;
  51. height: 400upx;
  52. width: 300upx;
  53. overflow-x: hidden;
  54. transition: 0.5s;
  55. display: flex;
  56. flex-direction: column;
  57. color: #fff;
  58. &.right{
  59. transform: translateX(600upx);
  60. &.show {
  61. transform: translateX(0);
  62. }
  63. }
  64. &.left{
  65. transform: translateX(-600upx);
  66. &.show {
  67. transform: translateX(300upx);
  68. }
  69. }
  70. .body {
  71. height: 100%;
  72. overflow-y: auto;
  73. }
  74. .item:nth-of-type(1) {
  75. height: 0;
  76. }
  77. .item:nth-of-type(1) {
  78. flex: 1 0 auto;
  79. }
  80. .action-area {
  81. .item-2 {
  82. button {
  83. border-radius: 0;
  84. line-height: 96upx;
  85. }
  86. }
  87. }
  88. }
  89. /* #ifdef H5 */
  90. .side-nav {
  91. box-sizing: border-box;
  92. }
  93. /* #endif */
  94. </style>