Advertisement
Guest User

GridLayoutExample.vue

a guest
Jul 22nd, 2019
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 2.79 KB | None | 0 0
  1. <template>
  2.   <div>
  3.     <grid-layout
  4.      :layout="item"
  5.      :col-num="12"
  6.      :row-height="20"
  7.      :is-draggable="true"
  8.      :is-resizable="true"
  9.      :is-mirrored="false"
  10.      :vertical-compact="false"
  11.      :responsive="true"
  12.      :use-css-transforms="false"
  13.      :auto-size="false"
  14.    >
  15.       <transition name="slide-fade"> <!-- Transition lors de l'apparition de la tuile-->
  16.         <grid-item
  17.          class="item"
  18.          :minW="6"
  19.          :minH="4"
  20.          :x="item[0].x"
  21.          :y="item[0].y"
  22.          :w="item[0].w"
  23.          :h="item[0].h"
  24.          :i="item[0].i"
  25.          :static="!isLock"
  26.        >
  27.           <div class="tuile-header">Nom de la tuile</div>
  28.           <div class="tuile-body">
  29.             <composant1-contenu-dans-la-tuile/>
  30.           </div>
  31.         </grid-item>
  32.       </transition>
  33.       <transition name="fade">
  34.         <grid-item
  35.          class="item"
  36.          :minW="6"
  37.          :minH="11"
  38.          :x="item[1].x"
  39.          :y="item[1].y"
  40.          :w="item[1].w"
  41.          :h="item[1].h"
  42.          :i="item[1].i"
  43.          :static="!isLock"
  44.        >
  45.           <div class="tuile-body">
  46.             <composant2-contenu-dans-la-tuile/>
  47.           </div>
  48.         </grid-item>
  49.       </transition>
  50.     </grid-layout>
  51.   </div>
  52. </template>
  53.  
  54. <script>
  55. import { GridLayout, GridItem } from 'vue-grid-layout'
  56.  
  57. import Composant1ContenuDansLaTuile from '@/components/gridItems/Composant2ContenuDansLaTuileComposant1ContenuDansLaTuile'
  58. import Composant2ContenuDansLaTuile from '@/components/gridItems/Composant2ContenuDansLaTuile'
  59.  
  60. import { mapActions, mapState } from 'vuex'
  61. export default {
  62.   data() {
  63.     return { idProp: null }
  64.   },
  65.   components: {
  66.     Composant1ContenuDansLaTuile
  67.     Composant2ContenuDansLaTuile
  68.     DetailsTableau,
  69.     GridLayout,
  70.     GridItem
  71.   },
  72.   computed: {
  73.     ...mapState('preferencesStore', ['isLock']),
  74.     item() {
  75.         return [
  76.           { x: 0, y: 0, w: 12, h: 4, i: '0' },
  77.           { x: 0, y: 4, w: 12, h: 24, i: '1' }
  78.         ]
  79.   }
  80. }
  81. <script>
  82. <style lang="css">
  83. .slide-fade-enter-active {
  84.   transition: all 0.6s ease;
  85. }
  86. .slide-fade-leave-active {
  87.   transition: all 0.4s cubic-bezier(1, 0.5, 0.8, 1);
  88. }
  89. .slide-fade-enter, .slide-fade-leave-to{
  90.   transform: translateX(25px);
  91.   opacity: 0;
  92. }
  93.  
  94. .fade-enter-active,
  95. .fade-leave-active {
  96.   transition: opacity 2s;
  97. }
  98. .fade-enter, .fade-leave-to {
  99.   opacity: 0;
  100. }
  101.  
  102. .item {
  103.   border-radius: 6px;
  104.   box-shadow: 6px 8px 20px 2px #d6d6d6;
  105.   z-index: 1;
  106. }
  107. .tuile-header {
  108.   border-top-left-radius: 6px;
  109.   border-top-right-radius: 6px;
  110.   color: #fff;
  111.   padding: 0px 15px 0px 15px;
  112.   background-color: #06769e;
  113. }
  114. .tuile-body {
  115.   height: 100%;
  116.   overflow-y: auto;
  117.   padding: 15px;
  118.   background-color: #fff3e0;
  119. }
  120. </style>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement