index.vue 784 B

123456789101112131415161718192021222324252627282930313233343536
  1. <template>
  2. <div class="button-pane" :style="style">
  3. <slot />
  4. </div>
  5. </template>
  6. <script setup lang="ts">
  7. import {computed} from "vue";
  8. const props = withDefaults(
  9. defineProps<{ dire?: 'row' | 'column', size?: number }>(),
  10. { dire: 'row', size: 64 }
  11. );
  12. const style = computed(() => {
  13. const isRow = props.dire === 'row';
  14. const bound = isRow ? { height: `${props.size}px` } : { width: `${props.size}px` }
  15. return {
  16. padding: isRow ? `4px ${props.size / 2}px` : `${props.size / 2}px 4px`,
  17. borderRadius: `${props.size / 2}px`,
  18. ...bound,
  19. flexDirection: props.dire
  20. }
  21. })
  22. </script>
  23. <style lang="scss" scoped>
  24. .button-pane {
  25. position: absolute;
  26. z-index: 1;
  27. background-color: var(--editor-menu-back);
  28. display: flex;
  29. align-items: center;
  30. }
  31. </style>