Skip to content

Commit

Permalink
* list: change dev example.
Browse files Browse the repository at this point in the history
  • Loading branch information
catouse committed Jul 23, 2024
1 parent 1947d21 commit e117271
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib/list/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@

## 远程数据

#### 根节点和子节点

```html:example
<div id="remoteNestedList"></div>
<div id="remoteNestedList2"></div>
```

### 远程数据

```html:example
<div id="remoteSimpleList"></div>
```
Expand Down
18 changes: 17 additions & 1 deletion lib/list/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,30 @@ onPageUpdate(() => {
defaultNestedShow: {'0:0:1': true},
activeOnHover: true,
onCheck: function (changes, checks) {
console.log('> onCheck', {changes, checks, allChecks: this.getChecks(), table: this});
console.log('> onCheck', {changes, checks, allChecks: this.getChecks(), list: this});
},
onClickItem: (...args) => {
console.log('>> onClickItem', args);
},
});
console.log('> remoteNestedList', remoteNestedList);

const remoteNestedList2 = new NestedList('#remoteNestedList2', {
items: '/lib/list/dev/nested-items-2.json',
checkbox: true,
checkOnClick: 'any',
selectOnChecked: true,
defaultNestedShow: false,
activeOnHover: true,
onCheck: function (changes, checks) {
console.log('> onCheck', {changes, checks, allChecks: this.getChecks(), list: this});
},
onClickItem: (...args) => {
console.log('>> onClickItem', args);
},
});
console.log('> remoteNestedList2', remoteNestedList2);

const remoteSimpleList = new List('#remoteSimpleList', {
checkbox: true,
checkOnClick: true,
Expand Down
4 changes: 4 additions & 0 deletions lib/list/dev/nested-items-2-1-1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[
{"text": "水果/西瓜/黄皮", "value": "fruit/watermelon/yellow", "keys": "fruit food xigua huangpi"},
{"checked": true, "text": "水果/西瓜/红皮", "value": "fruit/watermelon/red", "keys": "fruit food xigua hongpi"}
]
9 changes: 9 additions & 0 deletions lib/list/dev/nested-items-2-1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[
{
"text": "水果/西瓜",
"value": "fruit/watermelon",
"keys": "fruit food xigua",
"items": "/lib/list/dev/nested-items-2-1-1.json"
},
{"text": "水果/苹果", "value": "fruit/apple", "keys": "fruit food pingguo"}
]
3 changes: 3 additions & 0 deletions lib/list/dev/nested-items-2-2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[
{"checked": true, "text": "蔬菜/西红柿", "value": "vegetable/tomato", "keys": "fruit food xihongshi"}
]
21 changes: 21 additions & 0 deletions lib/list/dev/nested-items-2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[
{
"text": "水果",
"value": "fruit",
"items": {"url": "/lib/list/dev/nested-items-2-1.json"}
},
{
"text": "蔬菜",
"value": "vegetable",
"items": "/lib/list/dev/nested-items-2-2.json"
},
{
"checked": true,
"text": "肉类",
"value": "meat"
},
{
"text": "饮料",
"value": "drink"
}
]

0 comments on commit e117271

Please sign in to comment.