Press n or j to go to the next uncovered block, b, p or k for the previous block.
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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | 1x 1x 1x 1x | import React, { useState } from "react"; import { Select } from "@tencent/tea-component/lib/select"; import { Form } from "@tencent/tea-component/lib/form"; const options = [ { groupKey: "fruit", value: "strawberry", text: "草莓", tooltip: "甜甜甜" }, { groupKey: "fruit", value: "apple", text: "苹果", disabled: true, tooltip: "每日一苹果,医生远离我", }, { groupKey: "fruit", value: "orange", text: "橙子", tooltip: "丰富 VC 含量" }, { groupKey: "drink", value: "coca-cola", text: "可口可乐" }, { groupKey: "drink", value: "pepsi-cola", text: "百事可乐", tooltip: "百事可乐为什么比可口可乐好喝?", }, ]; const groups = { fruit: "水果", drink: "饮料", }; export default function SelectExample() { const [favorite, setFavorite] = useState(null); return ( <Form> <Form.Item label="原生下拉"> <Select type="native" size="m" groups={groups} options={options} value={favorite} onChange={value => setFavorite(value)} placeholder="请选择你最爱的水果" /> </Form.Item> <Form.Item label="模拟下拉"> <Select type="simulate" appearance="default" groups={groups} options={options} value={favorite} onChange={value => setFavorite(value)} placeholder="请选择你最爱的食品" /> </Form.Item> </Form> ); } |