From 4b98e05f756ea4cf556321777c93bb890b0957fb Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Sat, 23 Oct 2021 00:49:31 +0100 Subject: [PATCH] :sparkles: Support for _parent and _top targets (#289) --- src/components/LinkItems/Item.vue | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/components/LinkItems/Item.vue b/src/components/LinkItems/Item.vue index cc89198e..25896334 100644 --- a/src/components/LinkItems/Item.vue +++ b/src/components/LinkItems/Item.vue @@ -3,8 +3,8 @@ ['newtab', 'sametab', 'modal', 'workspace'].indexOf(value) !== -1, + validator: targetValidator, }, itemSize: String, enableStatusCheck: Boolean, @@ -80,6 +80,21 @@ export default { appConfig() { return this.$store.getters.appConfig; }, + /* Convert config target value, into HTML anchor target attribute */ + anchorTarget() { + switch (this.target) { + case 'sametab': return '_self'; + case 'newtab': return '_blank'; + case 'parent': return '_parent'; + case 'top': return '_top'; + default: return undefined; + } + }, + /* Get the href value for the anchor, if not opening in modal/ workspace */ + targetHref() { + const noAnchorNeeded = ['modal', 'workspace']; + return noAnchorNeeded.includes(this.target) ? '#' : this.url; + }, }, data() { return {