mirror of
https://github.com/element-plus/element-plus.git
synced 2025-02-17 11:49:41 +08:00
refactor(components): [button-group] switch to script-setup syntax (#6256)
This commit is contained in:
parent
7928a4d214
commit
c7d738e468
@ -123,10 +123,10 @@ button/custom
|
||||
|
||||
## Button-Group Attributes
|
||||
|
||||
| Attribute | Description | Type | Accepted Values | Default |
|
||||
| --------- | ------------------------------------------------ | ------ | --------------------------- | ------- |
|
||||
| size | control the size of buttons in this button-group | string | large / small | — |
|
||||
| type | control the type of buttons in this button-group | string | primary / success / warning | — |
|
||||
| Attribute | Description | Type | Accepted Values | Default |
|
||||
| --------- | ------------------------------------------------ | ------ | --------------------- | ------- |
|
||||
| size | control the size of buttons in this button-group | string | same as button's size | — |
|
||||
| type | control the type of buttons in this button-group | string | same as button's type | — |
|
||||
|
||||
## Button-Group Slots
|
||||
|
||||
|
@ -3,28 +3,22 @@
|
||||
<slot></slot>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { defineComponent, provide, reactive, toRef } from 'vue'
|
||||
<script lang="ts" setup>
|
||||
import { provide, reactive, toRef } from 'vue'
|
||||
import { buttonGroupContextKey } from '@element-plus/tokens'
|
||||
import { useNamespace } from '@element-plus/hooks'
|
||||
import { buttonGroupProps } from './button-group'
|
||||
|
||||
export default defineComponent({
|
||||
defineOptions({
|
||||
name: 'ElButtonGroup',
|
||||
props: buttonGroupProps,
|
||||
|
||||
setup(props) {
|
||||
provide(
|
||||
buttonGroupContextKey,
|
||||
reactive({
|
||||
size: toRef(props, 'size'),
|
||||
type: toRef(props, 'type'),
|
||||
})
|
||||
)
|
||||
const ns = useNamespace('button')
|
||||
return {
|
||||
ns,
|
||||
}
|
||||
},
|
||||
})
|
||||
const props = defineProps(buttonGroupProps)
|
||||
provide(
|
||||
buttonGroupContextKey,
|
||||
reactive({
|
||||
size: toRef(props, 'size'),
|
||||
type: toRef(props, 'type'),
|
||||
})
|
||||
)
|
||||
const ns = useNamespace('button')
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user