mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-28 21:19:37 +08:00
improve demo es6 class code style
This commit is contained in:
parent
2da59c3679
commit
f2d12306bd
@ -37,11 +37,8 @@ const columns = [{
|
|||||||
}];
|
}];
|
||||||
|
|
||||||
class Page extends React.Component {
|
class Page extends React.Component {
|
||||||
constructor() {
|
state = {
|
||||||
super();
|
visible: false,
|
||||||
this.state = {
|
|
||||||
visible: false,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
showModal = () => {
|
showModal = () => {
|
||||||
this.setState({ visible: true });
|
this.setState({ visible: true });
|
||||||
|
@ -17,13 +17,11 @@ Wrap your app with `LocaleProvider`, and apply the corresponding language packag
|
|||||||
import { Pagination, LocaleProvider } from 'antd';
|
import { Pagination, LocaleProvider } from 'antd';
|
||||||
import enUS from 'antd/lib/locale-provider/en_US';
|
import enUS from 'antd/lib/locale-provider/en_US';
|
||||||
|
|
||||||
function App() {
|
const App = () = >(
|
||||||
return (
|
<div>
|
||||||
<div>
|
<Pagination defaultCurrent={1} total={50} showSizeChanger />
|
||||||
<Pagination defaultCurrent={1} total={50} showSizeChanger />
|
</div>
|
||||||
</div>
|
};
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<LocaleProvider locale={enUS}>
|
<LocaleProvider locale={enUS}>
|
||||||
|
@ -19,12 +19,9 @@ import { Mention } from 'antd';
|
|||||||
const users = ['afc163', 'benjycui', 'yiminghe', 'jljsj33', 'dqaria', 'RaoHai'];
|
const users = ['afc163', 'benjycui', 'yiminghe', 'jljsj33', 'dqaria', 'RaoHai'];
|
||||||
|
|
||||||
class AsyncMention extends React.Component {
|
class AsyncMention extends React.Component {
|
||||||
constructor() {
|
state = {
|
||||||
super();
|
suggestions: [],
|
||||||
this.state = {
|
loading: false,
|
||||||
suggestions: [],
|
|
||||||
loading: false,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
fetchSuggestions(value, callback) {
|
fetchSuggestions(value, callback) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
@ -27,11 +27,8 @@ const webFrameworks = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
class CustomNavMention extends React.Component {
|
class CustomNavMention extends React.Component {
|
||||||
constructor() {
|
state = {
|
||||||
super();
|
suggestions: [],
|
||||||
this.state = {
|
|
||||||
suggestions: [],
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
onSearchChange = (value) => {
|
onSearchChange = (value) => {
|
||||||
const searchValue = value.toLowerCase();
|
const searchValue = value.toLowerCase();
|
||||||
|
@ -18,11 +18,8 @@ import { Mention } from 'antd';
|
|||||||
const { toEditorState } = Mention;
|
const { toEditorState } = Mention;
|
||||||
|
|
||||||
class App extends React.Component {
|
class App extends React.Component {
|
||||||
constructor() {
|
state = {
|
||||||
super();
|
value: toEditorState('@afc163'),
|
||||||
this.state = {
|
|
||||||
value: toEditorState('@afc163'),
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
handleChange = (editorState) => {
|
handleChange = (editorState) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
@ -19,11 +19,8 @@ const { toEditorState, getMentions } = Mention;
|
|||||||
const FormItem = Form.Item;
|
const FormItem = Form.Item;
|
||||||
|
|
||||||
class App extends React.Component {
|
class App extends React.Component {
|
||||||
constructor() {
|
state = {
|
||||||
super();
|
initValue: toEditorState('@afc163'),
|
||||||
this.state = {
|
|
||||||
initValue: toEditorState('@afc163'),
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
handleReset = (e) => {
|
handleReset = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
@ -32,11 +32,8 @@ function onSelect(suggestion, data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class CustomNavMention extends React.Component {
|
class CustomNavMention extends React.Component {
|
||||||
constructor() {
|
state = {
|
||||||
super();
|
suggestions: [],
|
||||||
this.state = {
|
|
||||||
suggestions: [],
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
onSearchChange = (value) => {
|
onSearchChange = (value) => {
|
||||||
const searchValue = value.toLowerCase();
|
const searchValue = value.toLowerCase();
|
||||||
|
Loading…
Reference in New Issue
Block a user