demo1.vue 826 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <template>
  2. <m-space>
  3. <m-button @click="open1">左边-left</m-button>
  4. <m-button @click="open2">上边-top</m-button>
  5. <m-button @click="open3">右边-right</m-button>
  6. <m-button @click="open4">下边-bottom</m-button>
  7. </m-space>
  8. <m-drawer
  9. v-model="drawerShow"
  10. title="基本使用"
  11. :direction="direction"
  12. >
  13. <div>我来啦。。。</div>
  14. </m-drawer>
  15. </template>
  16. <script setup>
  17. import { ref } from "vue";
  18. const drawerShow = ref(false);
  19. const direction = ref('left');
  20. const open1 = () => {
  21. drawerShow.value = true
  22. direction.value = 'left'
  23. }
  24. const open2 = () => {
  25. drawerShow.value = true
  26. direction.value = 'top'
  27. }
  28. const open3 = () => {
  29. drawerShow.value = true
  30. direction.value = 'right'
  31. }
  32. const open4 = () => {
  33. drawerShow.value = true
  34. direction.value = 'bottom'
  35. }
  36. </script>