Skip to content
This repository was archived by the owner on Nov 30, 2020. It is now read-only.

Commit 0650e3d

Browse files
authored
fix(tab-bar): add a built-in scroller if the default slot is not a scroller (#313)
fixes #312
1 parent e6d231d commit 0650e3d

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

components/tabs/TabBar.vue

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,18 @@
44
role="tablist"
55
@MDCTabBar:activated="onActivated"
66
>
7-
<slot />
7+
<slot v-if="$slots.default[0].tag.includes('m-tab-scroller')" />
8+
<!-- todo: it doesn't work with <div class='mdc-tab-scroller'> but only work with our own m-tab-scroller component. This need to be enhanced. -->
9+
<div
10+
v-else
11+
class="mdc-tab-scroller"
12+
>
13+
<div class="mdc-tab-scroller__scroll-area">
14+
<div class="mdc-tab-scroller__scroll-content">
15+
<slot />
16+
</div>
17+
</div>
18+
</div>
819
</div>
920
</template>
1021

@@ -53,6 +64,7 @@ export default {
5364
}
5465
},
5566
mounted () {
67+
console.log(this.$slots.default[0].tag)
5668
this.mdcTabBar = MDCTabBar.attachTo(this.$el)
5769
this.mdcTabBar.focusOnActivate = this.focusOnActivate
5870
this.mdcTabBar.useAutomaticActivation = this.useAutomaticActivation

components/tabs/TabIndicator.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import { MDCTabIndicator } from '@material/tab-indicator'
1515
import { baseComponentMixin, themeClassMixin } from '../base'
1616
1717
export default {
18-
name: 'TabIndicator',
1918
mixins: [baseComponentMixin, themeClassMixin],
2019
props: {
2120
fade: {

components/tabs/TabScroller.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import { MDCTabScroller } from '@material/tab-scroller'
1313
import { baseComponentMixin, themeClassMixin } from '../base'
1414
1515
export default {
16-
name: 'TabScroller',
1716
mixins: [baseComponentMixin, themeClassMixin],
1817
data () {
1918
return {

0 commit comments

Comments
 (0)