Skip to content

Commit 1c69765

Browse files
committed
feat: [Cascader] 级联菜单支持 tips 提示
1 parent 20c4567 commit 1c69765

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

src/components/c-cascader/demos/basic.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,19 @@ desc: 默认样式
77
```jsx
88

99
import React, { useState, useEffect } from 'react';
10-
import { CCascader } from 'cloud-react';
10+
import { CCascader, Tooltip, Icon } from 'cloud-react';
1111
const addressOptions = [
1212
{
1313
value: 'zhejiang',
1414
label: 'Zhejiang',
15+
info: '说明',
1516

1617

1718
children: [
1819
{
1920
value: 'hangzhou',
2021
label: 'Hangzhou',
22+
info: '说明',
2123
children: [
2224
{
2325
value: 'xihu',
@@ -124,6 +126,18 @@ export default function Demo() {
124126
onChange={onChange}
125127
placeholder="Please select"
126128
style={{ width: 328 }}
129+
optionRender={option => {
130+
return (
131+
<label title={option.title} style={{ display: 'flex', gap: 4 }}>
132+
{option.label}
133+
{option.info && (
134+
<Tooltip content={option.info} theme="light" placement="right" overlayStyle={{ zIndex: 10000 }}>
135+
<Icon type="question-circle" />
136+
</Tooltip>
137+
)}
138+
</label>
139+
);
140+
}}
127141
/>
128142
<div style={{ marginBottom: 24, marginTop: 40 }}>任意选项支持选择</div>
129143
<CCascader

0 commit comments

Comments
 (0)