| | |
| | | import Empty from '../Empty/Empty' |
| | | import Icon from '../Icon/Icon' |
| | | import isNil from 'lodash/isNil' |
| | | import { _t } from '@/libs/Language/Language' |
| | | interface OptionType { |
| | | label: string |
| | | value: string |
| | |
| | | [key: string]: any |
| | | } |
| | | |
| | | export default defineComponent<TagProps>({ |
| | | export default defineComponent<any>({ |
| | | // @ts-ignore |
| | | name: 'Tag', |
| | | emits: ['click', 'update:modelValue', 'change', 'mouseenter', 'update:data'], |
| | |
| | | }, |
| | | // 默认值 |
| | | defaultValue: { |
| | | type: String, |
| | | type: [String, Number], |
| | | default: '', |
| | | }, |
| | | // 默认值 |
| | | max: { |
| | | type: Number, |
| | | default: 999, |
| | | }, |
| | | className: { |
| | | type: String, |
| | | default: '', |
| | | }, |
| | | width: { |
| | | type: String, |
| | | default: '180px', |
| | | }, |
| | | }, |
| | | setup(props: TagProps, { attrs, slots, emit }: SetupContext) { |
| | |
| | | } |
| | | |
| | | return () => { |
| | | // showTip |
| | | // 多tag情况,传data[] |
| | | if (Array.isArray(props.data)) { |
| | | const msg = (item: DataType) => |
| | | item[label] || |
| | |
| | | return ( |
| | | // @ts-ignore |
| | | <Tip showTip={props.showTip} v={v}> |
| | | <div class={styles.flex}> |
| | | <div |
| | | class={{ |
| | | [styles.flex]: true, |
| | | [props.className]: props.className, |
| | | }} |
| | | > |
| | | <DRender /> |
| | | </div> |
| | | </Tip> |
| | |
| | | })} |
| | | </el-dropdown-menu> |
| | | ) : ( |
| | | <Empty /> |
| | | <Empty text={_t('暂无数据')} /> |
| | | ), |
| | | }} |
| | | > |
| | | <div |
| | | onMouseenter={onMouseenter} |
| | | style={{ width: props.width }} |
| | | class={{ |
| | | [styles.tagSelect]: true, |
| | | [styles.isSelectTag]: visible.value, |
| | |
| | | {currentName.value} |
| | | </span> |
| | | ) : ( |
| | | <div class={styles.pl}>请选择</div> |
| | | <div class={styles.pl}>{_t('请选择')}</div> |
| | | )} |
| | | <Icon |
| | | class={styles.iconDown} |