Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.36 KB | None | 0 0
  1. <template>
  2. <div class="hub-creation">
  3. <h1 class="hub-creation__main-title" v-if="option">{{option.home_creation_title}}</h1>
  4. <div class="hub-creation__content" v-if="option" v-html="option.txt_hub_creation"></div>
  5. <div id="head_cat"></div>
  6. <div class="hub-creation__cat">
  7. <div class="mdc-tab-bar" role="tablist">
  8. <div class="mdc-tab-scroller">
  9. <div class="mdc-tab-scroller__scroll-area">
  10. <div class="mdc-tab-scroller__scroll-content">
  11. <button
  12. class="mdc-tab mdc-tab--active" role="tab" aria-selected="true"
  13. data-tax="all"
  14. @click="activeTax = 'all'"
  15. tabindex="0"
  16. >
  17. <span class="mdc-tab__content">
  18. <span class="mdc-tab__text-label">All</span>
  19. </span>
  20. <span class="mdc-tab-indicator mdc-tab-indicator--active">
  21. <span class="mdc-tab-indicator__content mdc-tab-indicator__content--underline"></span>
  22. </span>
  23. <span class="mdc-tab__ripple"></span>
  24. </button>
  25.  
  26. <button
  27. class="mdc-tab" role="tab" aria-selected="false"
  28. v-for="(items, index) in tax"
  29. v-bind:key="items.ID"
  30. :data-tax="items.slug"
  31. @click="activeTax = items.slug"
  32. :tabindex="index + 1"
  33. >
  34. <span class="mdc-tab__content">
  35. <span class="mdc-tab__text-label">{{items.name}}</span>
  36. </span>
  37. <span class="mdc-tab-indicator">
  38. <span class="mdc-tab-indicator__content mdc-tab-indicator__content--underline"></span>
  39. </span>
  40. <span class="mdc-tab__ripple"></span>
  41. </button>
  42. </div>
  43. </div>
  44. </div>
  45. </div>
  46. </div>
  47. <div class="hub-creation__slide--wraper" >
  48. <transition-group name="creationAnimation" tag="div" class="article_pages_wraper page_visible">
  49. <div
  50. class="hub-creation__slide mdc-card mdc-ripple-upgraded mdc-card__primary-action creationAnimation"
  51. v-for="(items) in creations"
  52. :key="items.id"
  53. v-if="activeTax === 'all' || (setData(items.pure_taxonomies.Type).indexOf(activeTax) !== -1)"
  54. >
  55. <TemplateCreation :content="items"/>
  56. </div>
  57. </transition-group>
  58. </div>
  59. </div>
  60. </template>
  61.  
  62. <script>
  63. import { mapState } from 'vuex'
  64. import TemplateCreation from '~/components/creation/templateCreation.vue';
  65.  
  66. export default {
  67. data : function () {
  68. return {
  69. activeTax : 'all',
  70. }
  71. },
  72. components: {
  73. TemplateCreation
  74. },
  75. computed: {
  76. ...mapState({
  77. creations:state => state.creations.data,
  78. tax:state => state.creations.tax,
  79. option:state => state.option.data,
  80. }),
  81. },
  82. methods: {
  83. m_init: function () {
  84. if (document) {
  85. const MDC = this.$MDC;
  86.  
  87. const tabBar = new MDC.TabBar(document.querySelector('.mdc-tab-bar'));
  88.  
  89. const ripples = document.querySelectorAll('.mdc-ripple-surface, .mdc-ripple-upgraded, .mdc-tab__ripple');
  90.  
  91. if (ripples.length > 0) {
  92. ripples.forEach(function (riple) {
  93. MDC.Ripple.attachTo(riple);
  94. })
  95. }
  96. }
  97. },
  98.  
  99. setData: function (data, id) {
  100. const data_new = ['all']
  101.  
  102. if (!data) {
  103. return data_new
  104. }
  105.  
  106. data.forEach(function(element) {
  107. data_new.push(element.slug)
  108. });
  109.  
  110. return data_new
  111. },
  112.  
  113. },
  114. mounted(){
  115. this.m_init();
  116. },
  117. }
  118. </script>
  119. <style media="screen" lang="scss">
  120.  
  121. .flip-list-move {
  122. transition: transform 1s;
  123. }
  124. .creationAnimation {
  125. transform-origin: 10% 50%;
  126. z-index: 1;
  127.  
  128. &-move { transition: all 600ms ease-in-out 50ms }
  129. &-enter-active { transition: all 300ms ease-out }
  130.  
  131. &-leave-active {
  132. transition: all 300ms ease-in;
  133. position: absolute;
  134. z-index: 0;
  135. top: 75%;
  136. left: 20%;
  137. }
  138.  
  139. &-enter,
  140. &-leave-to { opacity: 0 }
  141. &-enter { transform: scale(0.9) }
  142. }
  143.  
  144. .hub-creation__slide--wraper{
  145. transition: min-height 1s ease;
  146. }
  147.  
  148. .hub-creation__slide--wraper{
  149. height: auto;
  150. min-height: 500px;
  151. }
  152. </style>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement