From 3cab98e6d24ec07d02c4ba1e027e9312f0b28bbe Mon Sep 17 00:00:00 2001 From: eidng8 Date: Fri, 24 Apr 2020 22:13:44 +0800 Subject: [PATCH 1/3] fix #42 --- src/App.vue | 23 ++++++++++++++++++++--- src/components/G8TreeView.vue | 9 ++++++--- src/components/types.ts | 7 ++++++- 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/src/App.vue b/src/App.vue index 995a207..d33843d 100644 --- a/src/App.vue +++ b/src/App.vue @@ -41,7 +41,18 @@ @tag-dblclick=" tagDblClicked = `${$event.node.name},${$event.tag.label},${$event.index}` " - > + > + + + @@ -90,7 +101,8 @@ export default class App extends Vue { const child: G8TreeItem = { key: `key-${i}`, name: `name ${i}`, - tags: [{ label: `tag ${i}` }], + color: i % 5, + tags: [{ color: i % 5 ? '' : 'blue', label: `tag ${i}` }], children: [], }; for (let j = 1; j < total; j++) { @@ -98,7 +110,8 @@ export default class App extends Vue { child.children!.push({ key: `key-${i}.${j}`, name: `name ${i}.${j}`, - tags: [{ label: `tag ${i}.${j}` }], + + tags: [{ color: i % 5 ? '' : 'blue', label: `tag ${i}.${j}` }], }); } // eslint-disable-next-line @typescript-eslint/no-non-null-assertion @@ -137,4 +150,8 @@ span[id] { border: 1px solid; display: inline-block; } + +.blue { + color: blue; +} diff --git a/src/components/G8TreeView.vue b/src/components/G8TreeView.vue index d7d360a..690c538 100644 --- a/src/components/G8TreeView.vue +++ b/src/components/G8TreeView.vue @@ -24,7 +24,9 @@ 'g8-tree__checked_some': intermediate, }" > - {{ item[itemLabel] }} + + {{ item[itemLabel] }} + + {{ tag[tagLabel] }} + diff --git a/src/components/types.ts b/src/components/types.ts index 2c00f3d..fa6336e 100644 --- a/src/components/types.ts +++ b/src/components/types.ts @@ -9,7 +9,7 @@ */ export interface G8TreeItem { /** - * Just to allow accessing data via index syntax. + * Just to allow accessing data via index syntax and arbitrary data to fit in. */ [key: string]: unknown; @@ -49,6 +49,11 @@ export interface G8TreeItem { * Node tag data */ export interface G8TreeItemTag { + /** + * Just to allow accessing data via index syntax and arbitrary data to fit in. + */ + [key: string]: unknown; + /** * Tag label. */ From b4c39164b82dc324a1f34d14eeed0941abcefeef Mon Sep 17 00:00:00 2001 From: eidng8 Date: Fri, 24 Apr 2020 22:43:51 +0800 Subject: [PATCH 2/3] fix #42 --- src/App.vue | 18 +++++++++--------- src/components/G8TreeView.vue | 9 ++++++++- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/App.vue b/src/App.vue index d33843d..b89aa91 100644 --- a/src/App.vue +++ b/src/App.vue @@ -42,14 +42,14 @@ tagDblClicked = `${$event.node.name},${$event.tag.label},${$event.index}` " > -