index.jsx 1006 B

12345678910111213141516171819202122232425262728293031323334353637
  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. inheritAttrs: false,
  9. props: {
  10. type: {
  11. type: String,
  12. default: 'primary'
  13. },
  14. size: String,
  15. icon: {},
  16. disabled: Boolean
  17. },
  18. setup (props, { attrs, slots }) {
  19. const cipTable = useTable()
  20. const $size = computed(() => {
  21. return getUsingConfig(props.size, cipTable.size, 'default')
  22. })
  23. console.log($size.value)
  24. /* 修改danger类型的按钮 转换为primary [注: UI标准中无颜色区分] */
  25. return () => <CipButton
  26. {...attrs}
  27. link
  28. class={['cip-table-button', `cip-table-button--${$size.value}`]}
  29. disabled={props.disabled}
  30. type={props.type === 'danger' ? 'primary' : props.type}
  31. size={$size.value}
  32. icon={props.icon}
  33. >
  34. {slots.default?.()}
  35. </CipButton>
  36. }
  37. }