-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
44 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,66 @@ | ||
# vue-simple-tabs | ||
|
||
Tabs component for vue.js | ||
|
||
## Installation: | ||
## Installation | ||
|
||
NPM: | ||
|
||
```bash | ||
npm install --save vue-simple-tabs | ||
``` | ||
|
||
Yarn: | ||
|
||
```bash | ||
yarn add vue-simple-tabs | ||
``` | ||
|
||
## Usage: | ||
## Usage | ||
|
||
```html | ||
<template> | ||
<tabs> | ||
<tab title="Tab 1" active="true"> | ||
Tab 1 content | ||
</tab> | ||
<tab title="Tab 2"> | ||
Tab 2 content | ||
</tab> | ||
<tab title="Tab 3"> | ||
Tab 3 content | ||
</tab> | ||
<tab title="Tab 1" active="true">Tab 1 content</tab> | ||
<tab title="Tab 2">Tab 2 content</tab> | ||
<tab title="Tab 3">Tab 3 content</tab> | ||
</tabs> | ||
</template> | ||
|
||
<script> | ||
import { Tabs, Tab } from 'vue-simple-tabs'; | ||
export default { | ||
components: { Tabs, Tab } | ||
}; | ||
</script> | ||
``` | ||
|
||
## Events | ||
|
||
You can add a handler for tab changed event. | ||
|
||
Example: | ||
|
||
```html | ||
<template> | ||
<tabs @changed="tabChanged"> | ||
<tab title="Tab 1" active="true">Tab 1</tab> | ||
<tab title="Tab 2">Tab 2</tab> | ||
<tab title="Tab 3">Tab 3</tab> | ||
</tabs> | ||
</template> | ||
|
||
<script> | ||
import { Tabs, Tab } from 'vue-simple-tabs'; | ||
import { Tabs, Tab } from 'vue-simple-tabs'; | ||
export default { | ||
components: { Tabs, Tab } | ||
} | ||
export default { | ||
components: { Tabs, Tab }, | ||
methods: { | ||
tabChanged(tab) { | ||
// Do something | ||
} | ||
} | ||
}; | ||
</script> | ||
``` | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters