Skip to content

Commit 7675b6a

Browse files
committed
Merge branch 'feat-imageText-mly' of github.com:ShuyunFF2E/cloud-react into v1-develop
2 parents d4136ce + 6dc7236 commit 7675b6a

2 files changed

Lines changed: 51 additions & 78 deletions

File tree

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

Lines changed: 51 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,19 @@ desc: 默认样式
55
---
66

77
```jsx
8-
9-
import React, { useState, useEffect } from 'react';
10-
import { CCascader, Tooltip, Icon } from 'cloud-react';
11-
const addressOptions = [
8+
import React, { useState, useEffect } from "react";
9+
import { CCascader, Tooltip, Icon } from "cloud-react";
10+
const addressOptions = [
1211
{
13-
value: 'zhejiang',
14-
label: 'Zhejiang',
15-
info: '说明',
16-
12+
value: "zhejiang",
13+
label: "Zhejiang",
14+
info: "说明",
1715

1816
children: [
1917
{
20-
value: 'hangzhou',
21-
label: 'Hangzhou',
22-
info: '说明',
18+
value: "hangzhou",
19+
label: "Hangzhou",
20+
info: "说明",
2321
children: [
2422
{
2523
value: "xihu",
@@ -124,42 +122,48 @@ export default function Demo() {
124122
);
125123
};
126124

127-
return (
128-
<div>
129-
<div style={{ marginBottom: 24 }}>仅叶子选项支持选择</div>
130-
<CCascader
131-
options={addressOptions}
132-
onChange={onChange}
133-
placeholder="Please select"
134-
style={{ width: 328 }}
135-
optionRender={option => {
136-
return (
137-
<label title={option.title} style={{ display: 'flex', gap: 4 }}>
138-
{option.label}
139-
{option.info && (
140-
<Tooltip content={option.info} theme="light" placement="right" overlayStyle={{ zIndex: 10000 }}>
141-
<Icon type="question-circle" />
142-
</Tooltip>
143-
)}
144-
</label>
145-
);
146-
}}
147-
/>
148-
<div style={{ marginBottom: 24, marginTop: 40 }}>任意选项支持选择</div>
149-
<CCascader
150-
options={addressOptions}
151-
onChange={onChange}
152-
placeholder="Please select"
153-
showSearch={{ filter: filter }}
154-
style={{ width: 328 }}
155-
changeOnSelect/>
156-
<div style={{ marginBottom: 24, marginTop: 40 }}>用级联组件展示地址</div>
157-
{
158-
!loading && <CCascader
159-
options={data}
160-
onChange={onChange}
161-
fieldNames={{ label: 'name', value: 'id', children: 'children' }}
162-
placeholder="Please select"
125+
return (
126+
<div>
127+
<div style={{ marginBottom: 24 }}>仅叶子选项支持选择</div>
128+
<CCascader
129+
options={addressOptions}
130+
onChange={onChange}
131+
placeholder="Please select"
132+
style={{ width: 328 }}
133+
optionRender={(option) => {
134+
return (
135+
<label title={option.title} style={{ display: "flex", gap: 4 }}>
136+
{option.label}
137+
{option.info && (
138+
<Tooltip
139+
content={option.info}
140+
theme="light"
141+
placement="right"
142+
overlayStyle={{ zIndex: 10000 }}
143+
>
144+
<Icon type="question-circle" />
145+
</Tooltip>
146+
)}
147+
</label>
148+
);
149+
}}
150+
/>
151+
<div style={{ marginBottom: 24, marginTop: 40 }}>任意选项支持选择</div>
152+
<CCascader
153+
options={addressOptions}
154+
onChange={onChange}
155+
placeholder="Please select"
156+
showSearch={{ filter: filter }}
157+
style={{ width: 328 }}
158+
changeOnSelect
159+
/>
160+
<div style={{ marginBottom: 24, marginTop: 40 }}>用级联组件展示地址</div>
161+
{!loading && (
162+
<CCascader
163+
options={data}
164+
onChange={onChange}
165+
fieldNames={{ label: "name", value: "id", children: "children" }}
166+
placeholder="Please select"
163167
style={{ width: 328 }}
164168
changeOnSelect
165169
/>

src/components/c-picker/demos/date-picker.md

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ desc: 基本用法,日期选择器。
1212
import React from "react";
1313
import moment from "moment";
1414
import { CPicker as DatePicker, Form, Field, Toggle } from "cloud-react";
15-
import React from "react";
16-
import moment from "moment";
17-
import { CPicker as DatePicker, Form, Field, Toggle } from "cloud-react";
18-
1915
const { TimePicker } = DatePicker;
2016

2117
const presets = [
@@ -36,31 +32,8 @@ const presets = [
3632
value: () =>
3733
moment().clone().subtract(1, "years").format("yyyy/MM/DD HH:mm:ss"),
3834
},
39-
{
40-
label: "三天前",
41-
value: () => moment().clone().subtract(2, "days"),
42-
},
43-
{
44-
label: "一周前",
45-
value: () => moment().clone().subtract(6, "days"),
46-
},
47-
{
48-
label: "一月前",
49-
value: () => moment().clone().subtract(1, "months").toDate(),
50-
},
51-
{
52-
label: "一年前",
53-
value: () =>
54-
moment().clone().subtract(1, "years").format("yyyy/MM/DD HH:mm:ss"),
55-
},
5635
];
5736

58-
const timePresets = [
59-
{
60-
label: "中午",
61-
value: () => moment().clone().startOf("day").add(12, "hours"),
62-
},
63-
];
6437
const timePresets = [
6538
{
6639
label: "中午",
@@ -81,10 +54,6 @@ class DatePickerDemo extends React.Component {
8154
this.setState({ value });
8255
};
8356

84-
onTimeChange = (time) => {
85-
console.log("time:", time);
86-
this.setState({ time });
87-
};
8857
onTimeChange = (time) => {
8958
console.log("time:", time);
9059
this.setState({ time });

0 commit comments

Comments
 (0)