12345678910111213141516171819202122232425262728293031323334353637383940 |
- import { computed } from 'vue'
- import { useTable } from '../hooks/use-table'
- import './index.less'
- import { getUsingConfig } from '@cip/utils/util'
- import CipButton from '../cip-button'
- export default {
- name: 'CipButtonText',
- inheritAttrs: false,
- props: {
- type: {
- type: String,
- default: 'primary'
- },
- size: String,
- icon: {},
- disabled: Boolean
- },
- setup (props, { attrs, slots }) {
- const cipTable = useTable()
- const $size = computed(() => {
- return getUsingConfig(props.size, cipTable.size, 'default')
- })
- const type = computed(() => {
- if (props.disabled) return 'default'
- return props.type === 'danger' ? 'primary' : props.type
- })
- /* 修改danger类型的按钮 转换为primary [注: UI标准中无颜色区分] */
- return () => <CipButton
- {...attrs}
- link
- class={['cip-table-button', `cip-table-button--${$size.value}`]}
- disabled={props.disabled}
- type={type.value}
- size={$size.value}
- icon={props.icon}
- >
- {slots.default?.()}
- </CipButton>
- }
- }
|