Fixed:demo文档修改import
This commit is contained in:
parent
1da88c9883
commit
831f934fb8
|
@ -4,6 +4,13 @@
|
|||
* @description 事例涵盖 checkbox如何选择,disable状态和部分选择状态。
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
import React, { Component } from 'react';
|
||||
import Tree from '../../src';
|
||||
|
||||
const TreeNode = Tree.TreeNode;
|
||||
|
||||
const defaultProps = {
|
||||
keys: ['0-0-0', '0-0-1']
|
||||
}
|
||||
|
@ -46,4 +53,7 @@ class Demo1 extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
Demo1.defaultProps = defaultProps;
|
||||
Demo1.defaultProps = defaultProps;
|
||||
|
||||
|
||||
export default Demo1;
|
|
@ -33,6 +33,42 @@ const generateData = (_level, _preKey, _tns) => {
|
|||
};
|
||||
generateData(z);
|
||||
*/
|
||||
|
||||
|
||||
import React, { Component } from 'react';
|
||||
import Tree from '../../src';
|
||||
|
||||
const x = 3;
|
||||
const y = 2;
|
||||
const z = 1;
|
||||
const gData = [];
|
||||
|
||||
const generateData = (_level, _preKey, _tns) => {
|
||||
const preKey = _preKey || '0';
|
||||
const tns = _tns || gData;
|
||||
|
||||
const children = [];
|
||||
for (let i = 0; i < x; i++) {
|
||||
const key = `${preKey}-${i}`;
|
||||
tns.push({ title: key, key });
|
||||
if (i < y) {
|
||||
children.push(key);
|
||||
}
|
||||
}
|
||||
if (_level < 0) {
|
||||
return tns;
|
||||
}
|
||||
const level = _level - 1;
|
||||
children.forEach((key, index) => {
|
||||
tns[index].children = [];
|
||||
return generateData(level, key, tns[index].children);
|
||||
});
|
||||
};
|
||||
generateData(z);
|
||||
|
||||
const TreeNode = Tree.TreeNode;
|
||||
|
||||
|
||||
class Demo2 extends Component{
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
@ -88,4 +124,7 @@ class Demo2 extends Component{
|
|||
</Tree>
|
||||
);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
export default Demo2;
|
|
@ -5,6 +5,41 @@
|
|||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
import React, { Component } from 'react';
|
||||
import Tree from '../../src';
|
||||
|
||||
const x = 3;
|
||||
const y = 2;
|
||||
const z = 1;
|
||||
const gData = [];
|
||||
|
||||
const generateData = (_level, _preKey, _tns) => {
|
||||
const preKey = _preKey || '0';
|
||||
const tns = _tns || gData;
|
||||
|
||||
const children = [];
|
||||
for (let i = 0; i < x; i++) {
|
||||
const key = `${preKey}-${i}`;
|
||||
tns.push({ title: key, key });
|
||||
if (i < y) {
|
||||
children.push(key);
|
||||
}
|
||||
}
|
||||
if (_level < 0) {
|
||||
return tns;
|
||||
}
|
||||
const level = _level - 1;
|
||||
children.forEach((key, index) => {
|
||||
tns[index].children = [];
|
||||
return generateData(level, key, tns[index].children);
|
||||
});
|
||||
};
|
||||
generateData(z);
|
||||
|
||||
const TreeNode = Tree.TreeNode;
|
||||
|
||||
class Demo3 extends Component{
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
@ -80,4 +115,6 @@ class Demo3 extends Component{
|
|||
</Tree>
|
||||
);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
export default Demo3;
|
|
@ -4,6 +4,42 @@
|
|||
* @description
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
import React, { Component } from 'react';
|
||||
import FormControl from 'bee-form-control';
|
||||
import Tree from '../../src';
|
||||
|
||||
const x = 3;
|
||||
const y = 2;
|
||||
const z = 1;
|
||||
const gData = [];
|
||||
|
||||
const generateData = (_level, _preKey, _tns) => {
|
||||
const preKey = _preKey || '0';
|
||||
const tns = _tns || gData;
|
||||
|
||||
const children = [];
|
||||
for (let i = 0; i < x; i++) {
|
||||
const key = `${preKey}-${i}`;
|
||||
tns.push({ title: key, key });
|
||||
if (i < y) {
|
||||
children.push(key);
|
||||
}
|
||||
}
|
||||
if (_level < 0) {
|
||||
return tns;
|
||||
}
|
||||
const level = _level - 1;
|
||||
children.forEach((key, index) => {
|
||||
tns[index].children = [];
|
||||
return generateData(level, key, tns[index].children);
|
||||
});
|
||||
};
|
||||
generateData(z);
|
||||
|
||||
const TreeNode = Tree.TreeNode;
|
||||
|
||||
const dataList = [];
|
||||
const generateList = (data) => {
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
|
@ -107,4 +143,6 @@ class Demo4 extends Component {
|
|||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default Demo4;
|
|
@ -4,6 +4,41 @@
|
|||
* @description 当点击展开,异步获取子节点数据
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
import React, { Component } from 'react';
|
||||
import Tree from '../../src';
|
||||
|
||||
const x = 3;
|
||||
const y = 2;
|
||||
const z = 1;
|
||||
const gData = [];
|
||||
|
||||
const generateData = (_level, _preKey, _tns) => {
|
||||
const preKey = _preKey || '0';
|
||||
const tns = _tns || gData;
|
||||
|
||||
const children = [];
|
||||
for (let i = 0; i < x; i++) {
|
||||
const key = `${preKey}-${i}`;
|
||||
tns.push({ title: key, key });
|
||||
if (i < y) {
|
||||
children.push(key);
|
||||
}
|
||||
}
|
||||
if (_level < 0) {
|
||||
return tns;
|
||||
}
|
||||
const level = _level - 1;
|
||||
children.forEach((key, index) => {
|
||||
tns[index].children = [];
|
||||
return generateData(level, key, tns[index].children);
|
||||
});
|
||||
};
|
||||
generateData(z);
|
||||
|
||||
const TreeNode = Tree.TreeNode;
|
||||
|
||||
function generateTreeNodes(treeNode) {
|
||||
const arr = [];
|
||||
const key = treeNode.props.eventKey;
|
||||
|
@ -95,4 +130,6 @@ class Demo5 extends Component{
|
|||
</Tree>
|
||||
);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
export default Demo5
|
428
demo/index.js
428
demo/index.js
File diff suppressed because one or more lines are too long
|
@ -38,6 +38,7 @@
|
|||
"bee-form-control": "^0.1.5",
|
||||
"classnames": "^2.2.5",
|
||||
"object-assign": "latest",
|
||||
"babel-runtime": "^6.23.0",
|
||||
"tinper-bee-core": "latest"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
Loading…
Reference in New Issue