From 432884a2af77d1ac327ee351ab156ad1a775fd0d Mon Sep 17 00:00:00 2001 From: Liyas Thomas Date: Thu, 15 Apr 2021 13:31:15 +0530 Subject: [PATCH] Select multiple collections (#1604) (#1605) --- components/collections/Collection.vue | 13 +++++++++++-- components/collections/index.vue | 3 +++ pages/doc.vue | 20 ++++++++++++++++++-- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/components/collections/Collection.vue b/components/collections/Collection.vue index 09a93809d..9d4447a75 100644 --- a/components/collections/Collection.vue +++ b/components/collections/Collection.vue @@ -17,12 +17,20 @@
+
@@ -103,6 +108,7 @@ export default { collectionJSON: "[]", items: [], docsMarkdown: "", + selected: [], } }, methods: { @@ -191,7 +197,17 @@ export default { }, useSelectedCollection(collection) { - let importCollection = `[${JSON.stringify(collection, null, 2)}]` + if (this.selected.find((coll) => coll == collection)) { + return + } + this.selected.push(collection) + let importCollection = JSON.stringify(this.selected, null, 2) + this.collectionJSON = JSON.stringify(JSON.parse(importCollection), null, 2) + }, + + removeSelectedCollection(collection) { + this.selected = this.selected.filter((coll) => coll != collection) + let importCollection = JSON.stringify(this.selected, null, 2) this.collectionJSON = JSON.stringify(JSON.parse(importCollection), null, 2) }, },