schangxiang@126.com
2025-05-07 cace264ad9d86a7831099810b079da1141957add
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { defineComponent } from 'vue'
import Icon from '@/components/Icon/Icon'
import styles from './Select.module.scss'
 
export default defineComponent<{ [key: string]: any }>({
  name: 'Option',
 
  setup(props, { attrs, slots, emit }) {
    return () => {
      if (attrs.tip) {
        return (
          <el-option {...attrs}>
            <div class={styles.option}>
              <span>{attrs.label}</span>
              <el-tooltip effect="dark" content={attrs.tip} placement="top">
                <Icon icon="wen" width={16} height={16} />
              </el-tooltip>
            </div>
          </el-option>
        )
      }
      return <el-option {...attrs}>{slots.default?.()}</el-option>
    }
  },
})