|
|
hace 4 años | |
|---|---|---|
| .. | ||
| src | hace 4 años | |
| tests | hace 5 años | |
| .eslintignore | hace 5 años | |
| .eslintrc.js | hace 5 años | |
| .gitignore | hace 5 años | |
| .huskyrc.js | hace 5 años | |
| README.md | hace 4 años | |
| commitlint.config.js | hace 5 años | |
| lint-staged.config.js | hace 5 años | |
| package-lock.json | hace 4 años | |
| package.json | hace 4 años | |
| prettier.config.js | hace 5 años | |
| rollup.config.js | hace 4 años | |
| tsconfig.json | hace 5 años | |
基于 TypeScript 编写的树结构库
$ npm i -S @sc/tree
$ npm run test
$ npm run build
const rawData: TreeRaw[] = [
{ ID: '1', parentID: '-1', seq: 1 },
{ ID: '2', parentID: '-1', seq: 2 },
{ ID: '3', parentID: '-1', seq: 3 },
];
const tree = new Tree(rawData);
const node = tree.find('1');
tree.prepareInsert(rawData);
...
ctx循环引用导致handsontable栈溢出,因此节点方法及属性不再直接挂载到ctx对象中,而是通过getCtx()获取节点上下文对象。
node.getCtx().row();
node.getCtx().parent();
node.getCtx().children();
...
具体接口请参考声明文件。