diff --git a/packages/tab/demo/index.vue b/packages/tab/demo/index.vue index a24b9e93f..cd0cca3ea 100644 --- a/packages/tab/demo/index.vue +++ b/packages/tab/demo/index.vue @@ -18,7 +18,7 @@ - + {{ $t('content') }} {{ index }} @@ -26,7 +26,7 @@ - + {{ $t('content') }} {{ index }} @@ -34,7 +34,7 @@ - + {{ $t('content') }} {{ index }} @@ -73,7 +73,7 @@ export default { i18n: { 'zh-CN': { - tab: '选项 ', + tab: '标签 ', title2: '横向滚动', title3: '禁用标签', title4: '样式风格', diff --git a/packages/tab/en-US.md b/packages/tab/en-US.md index a66845432..df9b78c4e 100644 --- a/packages/tab/en-US.md +++ b/packages/tab/en-US.md @@ -49,7 +49,7 @@ You can set `disabled` attribute on the corresponding `van-tab`. ```html - + content of tab {{ index }} @@ -71,7 +71,7 @@ Tabs styled as cards. ```html - + content of tab {{ index }} @@ -81,7 +81,7 @@ Tabs styled as cards. ```html - + content of tab {{ index }} diff --git a/packages/tab/test/__snapshots__/demo.spec.js.snap b/packages/tab/test/__snapshots__/demo.spec.js.snap index 36b2ed66c..f8ba226a5 100644 --- a/packages/tab/test/__snapshots__/demo.spec.js.snap +++ b/packages/tab/test/__snapshots__/demo.spec.js.snap @@ -92,10 +92,6 @@ exports[`renders demo correctly 1`] = ` - @@ -119,10 +115,6 @@ exports[`renders demo correctly 1`] = ` - @@ -142,14 +134,6 @@ exports[`renders demo correctly 1`] = ` - - @@ -194,7 +178,7 @@ exports[`renders demo correctly 1`] = `
- 选项 + 标签
@@ -204,7 +188,7 @@ exports[`renders demo correctly 1`] = `
- 选项 + 标签
diff --git a/packages/tab/zh-CN.md b/packages/tab/zh-CN.md index fc6c12366..4b9fcccfa 100644 --- a/packages/tab/zh-CN.md +++ b/packages/tab/zh-CN.md @@ -38,7 +38,7 @@ export default { ```html - + 内容 {{ index }} @@ -50,9 +50,9 @@ export default { ```html - - 内容 {{ index }} - + 内容 1 + 内容 2 + 内容 3 ``` @@ -72,9 +72,9 @@ export default { ```html - - 内容 {{ index }} - + 内容 1 + 内容 2 + 内容 3 ``` @@ -84,9 +84,8 @@ export default { ```html - - 内容 {{ index }} - + 内容 1 + 内容 2 ``` diff --git a/packages/tabs/index.vue b/packages/tabs/index.vue index 1e1391ab6..2134ad1ff 100644 --- a/packages/tabs/index.vue +++ b/packages/tabs/index.vue @@ -288,14 +288,18 @@ export default create({ } }, - findAvailableTab(index, reverse) { + findAvailableTab(active, reverse) { const diff = reverse ? -1 : 1; + let index = active; + while (index >= 0 && index < this.tabs.length) { if (!this.tabs[index].disabled) { return index; } index += diff; } + + return active; }, // emit event when clicked