Advertisement
Guest User

Untitled

a guest
May 4th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. <template>
  2. <div class="tab-panel"
  3. :class="{ 'is-hiding' : !show }"
  4. v-show="show"
  5. :transition="transiton"
  6. transition-mode="out-in">
  7. <slot></slot>
  8. </div>
  9. </template>
  10.  
  11. <script>
  12. module.exports = {
  13. data () {
  14. return {
  15. show: false,
  16. index: 0
  17. }
  18. },
  19. props: {
  20. header: {
  21. type: String
  22. },
  23. disabled: {
  24. type: Boolean,
  25. default: false
  26. }
  27. },
  28. computed: {
  29. show () {
  30. return this.$parent.activeIndex === this.index
  31. },
  32. transiton () {
  33. return this.$parent.effect
  34. }
  35. },
  36. created () {
  37. this.$parent.tabs.push({
  38. header: this.header,
  39. disabled: this.disabled
  40. })
  41.  
  42. this.index = this.$parent.tabs.length - 1
  43. }
  44. }
  45. </script>
  46.  
  47. <style lang="stylus" scoped>
  48. .tab-panel {
  49.  
  50. &.is-hiding {
  51. position: absolute;
  52. top: 0;
  53. left: 50%;
  54. transform: translate3d(-50%, 0, 0)
  55. width 100%
  56. }
  57. }
  58. </style>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement