2023-03-17 15:46:04 +08:00
|
|
|
import { computed, defineComponent } from 'vue'
|
|
|
|
import { useProviderConfigState } from '../config-provider/context'
|
|
|
|
import useStyle from './style'
|
2023-03-08 16:10:20 +08:00
|
|
|
export default defineComponent({
|
|
|
|
name: 'AButton',
|
2023-03-17 15:46:04 +08:00
|
|
|
inheritAttrs: false,
|
|
|
|
props: {
|
|
|
|
prefixCls: {
|
|
|
|
type: String
|
|
|
|
}
|
|
|
|
},
|
2023-03-08 16:10:20 +08:00
|
|
|
setup(props, { slots }) {
|
2023-03-17 15:46:04 +08:00
|
|
|
const { getPrefixCls } = useProviderConfigState()
|
|
|
|
const prefixCls = computed(() => getPrefixCls('btn', props.prefixCls))
|
|
|
|
const [wrapSSR, hashId] = useStyle(prefixCls)
|
2023-03-08 16:10:20 +08:00
|
|
|
return () => {
|
2023-03-17 15:46:04 +08:00
|
|
|
const cls = {
|
|
|
|
[prefixCls.value]: true,
|
|
|
|
[hashId.value]: true
|
|
|
|
}
|
|
|
|
return wrapSSR(<button class={cls}>{slots.default?.()}</button>)
|
2023-03-08 16:10:20 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|