From e1172715f5e1821ea629a4308a98495ba37b43a8 Mon Sep 17 00:00:00 2001 From: sunhao Date: Tue, 23 Jul 2024 20:39:18 +0800 Subject: [PATCH] * list: change dev example. --- lib/list/README.md | 6 +++++- lib/list/dev.ts | 18 +++++++++++++++++- lib/list/dev/nested-items-2-1-1.json | 4 ++++ lib/list/dev/nested-items-2-1.json | 9 +++++++++ lib/list/dev/nested-items-2-2.json | 3 +++ lib/list/dev/nested-items-2.json | 21 +++++++++++++++++++++ 6 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 lib/list/dev/nested-items-2-1-1.json create mode 100644 lib/list/dev/nested-items-2-1.json create mode 100644 lib/list/dev/nested-items-2-2.json create mode 100644 lib/list/dev/nested-items-2.json diff --git a/lib/list/README.md b/lib/list/README.md index ffb88b2f32..a804298f84 100644 --- a/lib/list/README.md +++ b/lib/list/README.md @@ -2,10 +2,14 @@ ## 远程数据 +#### 根节点和子节点 + ```html:example -
+
``` +### 远程数据 + ```html:example
``` diff --git a/lib/list/dev.ts b/lib/list/dev.ts index 5ffcb610c6..65e132f5d5 100644 --- a/lib/list/dev.ts +++ b/lib/list/dev.ts @@ -14,7 +14,7 @@ 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); @@ -22,6 +22,22 @@ onPageUpdate(() => { }); 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, diff --git a/lib/list/dev/nested-items-2-1-1.json b/lib/list/dev/nested-items-2-1-1.json new file mode 100644 index 0000000000..fd3b5c5eb3 --- /dev/null +++ b/lib/list/dev/nested-items-2-1-1.json @@ -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"} +] diff --git a/lib/list/dev/nested-items-2-1.json b/lib/list/dev/nested-items-2-1.json new file mode 100644 index 0000000000..335d9c6adf --- /dev/null +++ b/lib/list/dev/nested-items-2-1.json @@ -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"} +] diff --git a/lib/list/dev/nested-items-2-2.json b/lib/list/dev/nested-items-2-2.json new file mode 100644 index 0000000000..d798dedcfe --- /dev/null +++ b/lib/list/dev/nested-items-2-2.json @@ -0,0 +1,3 @@ +[ + {"checked": true, "text": "蔬菜/西红柿", "value": "vegetable/tomato", "keys": "fruit food xihongshi"} +] diff --git a/lib/list/dev/nested-items-2.json b/lib/list/dev/nested-items-2.json new file mode 100644 index 0000000000..021c5cf873 --- /dev/null +++ b/lib/list/dev/nested-items-2.json @@ -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" + } +]