index.vue 902 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <script lang="ts" setup>
  2. import { ref } from "vue"
  3. import { Setting } from "@element-plus/icons-vue"
  4. interface Props {
  5. buttonTop?: number
  6. }
  7. const props = withDefaults(defineProps<Props>(), {
  8. buttonTop: 350
  9. })
  10. const buttonTopCss = props.buttonTop + "px"
  11. const show = ref(false)
  12. </script>
  13. <template>
  14. <div class="handle-button" @click="show = true">
  15. <el-icon :size="24">
  16. <Setting />
  17. </el-icon>
  18. </div>
  19. <el-drawer v-model="show" size="300px" :with-header="false">
  20. <slot />
  21. </el-drawer>
  22. </template>
  23. <style lang="scss" scoped>
  24. .handle-button {
  25. width: 48px;
  26. height: 48px;
  27. background-color: var(--v3-rightpanel-button-bg-color);
  28. position: fixed;
  29. top: v-bind(buttonTopCss);
  30. right: 0;
  31. border-radius: 6px 0 0 6px;
  32. z-index: 10;
  33. cursor: pointer;
  34. pointer-events: auto;
  35. color: #fff;
  36. display: flex;
  37. align-items: center;
  38. justify-content: center;
  39. }
  40. </style>