2
0
mirror of https://github.com/tenrok/vue-form-wizard.git synced 2026-06-09 00:02:24 +03:00

#114 Provide unique ids for steps and tabs without spaces

This commit is contained in:
cristijora
2017-11-28 17:11:10 +02:00
parent 407ee9769f
commit d11b5ed9cf
3 changed files with 7 additions and 6 deletions
+1 -1
View File
@@ -232,7 +232,7 @@
},
addTab (item) {
const index = this.$slots.default.indexOf(item.$vnode)
item.tabId = `t-${item.title.replace(/ /g, '')}${index}`
item.tabId = `${item.title.replace(/ /g, '')}${index}`
this.tabs.splice(index, 0, item)
// if a step is added before the current one, go to it
if (index < this.activeTabIndex + 1) {
+4 -3
View File
@@ -1,9 +1,9 @@
<template>
<div v-show="active" class="wizard-tab-container"
role="tabpanel"
:id="title"
:id="tabId"
:aria-hidden="!active"
:aria-labelledby="title">
:aria-labelledby="`step-${tabId}`">
<slot :active="active">
</slot>
</div>
@@ -43,7 +43,8 @@
return {
active: false,
validationError: null,
checked: false
checked: false,
tabId: ''
}
},
computed: {
+2 -2
View File
@@ -4,8 +4,8 @@
<div class="wizard-icon-circle md"
role="tab"
:tabindex="tab.checked ? 0 : ''"
:id="tab.tabId"
:aria-controls="tab.title"
:id="`step-${tab.tabId}`"
:aria-controls="tab.tabId"
:aria-disabled="tab.active"
:aria-selected="tab.active"
:class="{checked: tab.checked,square_shape:isStepSquare, tab_shape:isTabShape}"