index.jsx 954 B

1234567891011121314151617181920212223242526272829303132333435
  1. import { computed } from 'vue'
  2. import { useTable } from '../hooks/use-table'
  3. import './index.less'
  4. import { getUsingConfig } from '@cip/utils/util'
  5. import CipButton from '../cip-button'
  6. export default {
  7. name: 'CipButtonText',
  8. props: {
  9. type: {
  10. type: String,
  11. default: 'primary'
  12. },
  13. size: String,
  14. icon: {},
  15. disabled: Boolean
  16. },
  17. setup (props, { attrs, slots }) {
  18. const cipTable = useTable()
  19. const _size = computed(() => {
  20. return getUsingConfig(props.size, cipTable.size, 'default')
  21. })
  22. /* 修改danger类型的按钮 转换为primary [注: UI标准中无颜色区分] */
  23. return () => <CipButton
  24. {...attrs}
  25. link
  26. class={['cip-table-button', `cip-table-button--${_size.value}`]}
  27. disabled={props.disabled}
  28. type={props.type === 'danger' ? 'primary' : props.type}
  29. size={_size.value}
  30. icon={props.icon}
  31. >
  32. {slots.default?.()}
  33. </CipButton>
  34. }
  35. }