diff --git a/components/grid/demo/playground.md b/components/grid/demo/playground.md index ff8bd4cc2f..b2df71701b 100644 --- a/components/grid/demo/playground.md +++ b/components/grid/demo/playground.md @@ -16,30 +16,26 @@ A simple playground for column count and gutter. ```jsx import { Row, Col, Slider } from 'antd'; +const gutters = {}; +const vgutters = {}; +const colCounts = {}; + +[8, 16, 24, 32, 40, 48].forEach((value, i) => { + gutters[i] = value; +}); +[8, 16, 24, 32, 40, 48].forEach((value, i) => { + vgutters[i] = value; +}); +[2, 3, 4, 6, 8, 12].forEach((value, i) => { + colCounts[i] = value; +}); + class App extends React.Component { - gutters = {}; - - vgutters = {}; - - colCounts = {}; - - constructor() { - super(); - this.state = { - gutterKey: 1, - vgutterKey: 1, - colCountKey: 2, - }; - [8, 16, 24, 32, 40, 48].forEach((value, i) => { - this.gutters[i] = value; - }); - [8, 16, 24, 32, 40, 48].forEach((value, i) => { - this.vgutters[i] = value; - }); - [2, 3, 4, 6, 8, 12].forEach((value, i) => { - this.colCounts[i] = value; - }); - } + state = { + gutterKey: 1, + vgutterKey: 1, + colCountKey: 2, + }; onGutterChange = gutterKey => { this.setState({ gutterKey }); @@ -56,7 +52,7 @@ class App extends React.Component { render() { const { gutterKey, vgutterKey, colCountKey } = this.state; const cols = []; - const colCount = this.colCounts[colCountKey]; + const colCount = colCounts[colCountKey]; let colCode = ''; for (let i = 0; i < colCount; i++) { cols.push( @@ -72,39 +68,42 @@ class App extends React.Component {
{`-\n${colCode}
`}
{`+\n${colCode}
`}
{`+\n${colCode}
`}
{`> ); }\n${colCode}
`}