-
Notifications
You must be signed in to change notification settings - Fork 584
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(CascaderSelect): support value not in data
fixed #407
- Loading branch information
1 parent
7bff860
commit 93e4227
Showing
3 changed files
with
61 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# 无障碍 | ||
|
||
- order: 8 | ||
- order: 9 | ||
|
||
请参考`ARIA and KeyBoard`。 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# 渲染 DataSource 中不存在的 value | ||
|
||
- order: 8 | ||
|
||
--- | ||
|
||
```jsx | ||
import { CascaderSelect } from '@alifd/next'; | ||
import 'whatwg-fetch'; | ||
|
||
class Demo extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
|
||
this.state = { | ||
data: [] | ||
}; | ||
|
||
this.handleChange = this.handleChange.bind(this); | ||
} | ||
|
||
componentDidMount() { | ||
fetch('https://os.alipayobjects.com/rmsportal/ODDwqcDFTLAguOvWEolX.json') | ||
.then(response => response.json()) | ||
.then(data => { | ||
data[1].disabled = true; | ||
this.setState({ data }); | ||
}) | ||
.catch(e => console.log(e)); | ||
} | ||
|
||
handleChange(value, data, extra) { | ||
console.log(value, data, extra); | ||
} | ||
|
||
render() { | ||
return <CascaderSelect multiple valueRender={(item) => item.label ? item.label : item.value === '4326' ? '哈哈哈哈' : item.value} defaultValue="4326" style={{ width: '302px' }} dataSource={this.state.data} onChange={this.handleChange} />; | ||
} | ||
} | ||
ReactDOM.render(<Demo />, mountNode) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters