From 30a1d5c72d51694cb0997d4057c6a6dd813e2485 Mon Sep 17 00:00:00 2001 From: Cagatay Civici Date: Fri, 27 Aug 2021 16:41:51 +0300 Subject: [PATCH] #1254 for Dock --- api-generator/components/dock.js | 6 +++++ src/components/dock/Dock.d.ts | 1 + src/components/dock/Dock.vue | 35 ++++------------------------ src/components/dock/DockSub.vue | 39 ++++++++++++++++++++++++-------- src/views/dock/DockDoc.vue | 6 +++++ 5 files changed, 48 insertions(+), 39 deletions(-) diff --git a/api-generator/components/dock.js b/api-generator/components/dock.js index 594cf3d33..7fd3997a2 100644 --- a/api-generator/components/dock.js +++ b/api-generator/components/dock.js @@ -22,6 +22,12 @@ const DockProps = [ type: "object", default: "null", description: "Inline style of the element." + }, + { + name: "exact", + type: "boolean", + default: "true", + description: "Whether to apply 'router-link-active-exact' class if route exactly matches the item path." } ]; diff --git a/src/components/dock/Dock.d.ts b/src/components/dock/Dock.d.ts index 7686ba197..908876ca6 100644 --- a/src/components/dock/Dock.d.ts +++ b/src/components/dock/Dock.d.ts @@ -5,6 +5,7 @@ interface DockProps { model?: any[]; class?: string; style?: any; + exact?: boolean; } declare class Dock { diff --git a/src/components/dock/Dock.vue b/src/components/dock/Dock.vue index 1c55289fb..eaf85871a 100644 --- a/src/components/dock/Dock.vue +++ b/src/components/dock/Dock.vue @@ -1,6 +1,6 @@ @@ -16,35 +16,10 @@ export default { }, model: null, class: null, - style: null - }, - data() { - return { - currentIndex: -3 - } - }, - methods: { - onListMouseLeave() { - this.currentIndex = -3; - }, - onItemMouseEnter(index) { - this.currentIndex = index; - }, - onItemClick(e, item) { - if (item.command) { - item.command({ originalEvent: e, item }); - } - - e.preventDefault(); - }, - itemClass(index) { - return ['p-dock-item', { - 'p-dock-item-second-prev': (this.currentIndex - 2) === index, - 'p-dock-item-prev': (this.currentIndex - 1) === index, - 'p-dock-item-current': this.currentIndex === index, - 'p-dock-item-next': (this.currentIndex + 1) === index, - 'p-dock-item-second-next': (this.currentIndex + 2) === index - }]; + style: null, + exact: { + type: Boolean, + default: true } }, computed: { diff --git a/src/components/dock/DockSub.vue b/src/components/dock/DockSub.vue index 4071b0403..2067794b4 100644 --- a/src/components/dock/DockSub.vue +++ b/src/components/dock/DockSub.vue @@ -3,17 +3,17 @@