ny
22 小时以前 282fbc6488f4e8ceb5fda759f963ee88fbf7b999
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<script lang="ts" setup>
import { computed, unref } from 'vue';
 
import { useAttrs } from '@jnpf/hooks';
 
import { omit } from 'lodash-es';
 
import { buttonProps } from './props';
 
defineOptions({ inheritAttrs: false, name: 'JnpfButton' });
const props = defineProps(buttonProps);
const attrs = useAttrs({ excludeDefaultKeys: false });
const getBindValue = computed(() => omit({ ...unref(attrs), ...props }, ['align', 'buttonText']));
</script>
 
<template>
  <div :class="`jnpf-button jnpf-button-${align}`">
    <a-button v-bind="getBindValue">{{ buttonText }}</a-button>
  </div>
</template>
<style lang="scss" scoped>
.jnpf-button {
  width: 100%;
 
  &-left {
    text-align: left;
  }
 
  &-center {
    text-align: center;
  }
 
  &-right {
    text-align: right;
  }
}
</style>