diff --git a/components/tabs/README.md b/components/tabs/README.md index 6d5d03d9..6f87ad8a 100644 --- a/components/tabs/README.md +++ b/components/tabs/README.md @@ -1,13 +1,23 @@ ## Usage ```html - - item one - item two - item three + + item one + item two + item three ``` +```javascript +var vm = new Vue({ + methods: { + onSelected(idx) { + console.log(`selected index: ${idx}`); + }, + }, +}); +``` + ### props #### mdc-tab @@ -15,33 +25,30 @@ mdc-tab behaves as a navigational link. Add an `href` for simple link behavior or the `to` property for router-link behavior. mdc-tab dispatches `@click` event. - -| prop | Type | Default | Description | -|-------|------|---------|-------------| -|`active`|Boolean| false | set the tab active | -|`event`|String| optional | optional event to emit on click | -|`event-target`|Object| vm.$root | optional event target, defaults to root bus | -|`event-args`|Array| [] | optional event args | -|`to`|String, Object| undefined | router-link property _(*)_ | -|`replace`|Boolean| false | router-link property _(*)_ | -|`append`|Boolean| false | router-link property _(*)_ | -|`exact`|Boolean| false | router-link property _(*)_ | -|`active-class`|String| router-link-active | router-link property _(*)_ | -|`exact-active-class`|String| router-link-exact-active | router-link property _(*)_ | - -> _(*)_ Requires [vue-router](https://router.vuejs.org) +| prop | Type | Default | Description | +| -------------------- | -------------- | ------------------------ | ------------------------------------------- | +| `active` | Boolean | false | set the tab active | +| `event` | String | optional | optional event to emit on click | +| `event-target` | Object | vm.$root | optional event target, defaults to root bus | +| `event-args` | Array | [] | optional event args | +| `to` | String, Object | undefined | router-link property _(\*)_ | +| `replace` | Boolean | false | router-link property _(\*)_ | +| `append` | Boolean | false | router-link property _(\*)_ | +| `exact` | Boolean | false | router-link property _(\*)_ | +| `active-class` | String | router-link-active | router-link property _(\*)_ | +| `exact-active-class` | String | router-link-exact-active | router-link property _(\*)_ | + +> _(\*)_ Requires [vue-router](https://router.vuejs.org) > If the `to` property is defined, the item behaves as a > [router-link](https://router.vuejs.org/en/api/router-link.html) #### mdc-tab-bar -| prop | Type | Default | Description | -|-------|------|---------|-------------| -|`indicator-primary`|Boolean| false | whether the indicator has the primary color | -|`indicator-accent`|Boolean| false | whether the indicator has the accent color | - -> emits `@change` event with the active index as parameter +### events +| props | args | Description | +| --------- | ------ | ---------------------------------------------------- | +| `@change` | number | notify listeners with the active index as parameter. | ### Tabs with icons @@ -66,4 +73,5 @@ or the `to` property for router-link behavior. mdc-tab dispatches `@click` event ``` ### reference -- + +* diff --git a/components/tabs/demo.vue b/components/tabs/demo.vue index 37a5b16e..eb6e27f9 100644 --- a/components/tabs/demo.vue +++ b/components/tabs/demo.vue @@ -2,15 +2,17 @@

Simple

- - item one - item two - item three + + {{item}}
+
+
+ Selected: {{selectedItem}} +

With icons and text

- + Recents Favorites Nearby @@ -18,3 +20,26 @@
+ + + + diff --git a/components/tabs/mdc-tab-bar.vue b/components/tabs/mdc-tab-bar.vue index 385f1c84..656b5f50 100644 --- a/components/tabs/mdc-tab-bar.vue +++ b/components/tabs/mdc-tab-bar.vue @@ -12,16 +12,9 @@ import MDCTabFoundation from '@material/tabs/tab/foundation'; export default { name: 'mdc-tab-bar', - props: { - 'indicator-primary': Boolean, - 'indicator-accent': Boolean, - }, data() { return { - classes: { - 'mdc-tab-bar--indicator-primary': this.indicatorPrimary, - 'mdc-tab-bar--indicator-accent': this.indicatorAccent, - }, + classes: {}, indicatorStyles: {}, tabs: [], };