vue-grid-layout
Mobile test
by bbilguun
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.28/vue.min.js"></script>
<script src="https://inspired-aria-158313.appspot.com/vue-grid-layout.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fastclick/1.0.6/fastclick.min.js"></script>
<script
src="https://code.jquery.com/jquery-3.4.1.min.js"
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
crossorigin="anonymous"></script>
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>
<div id="app">
<input type="text" v-model="pivotItem.name" >
<button @click.prevent="addItem">Add</button>
<grid-layout
:layout="layout"
:col-num="16"
:row-height="30"
:is-draggable="true"
:is-resizable="true"
:vertical-compact="true"
:margin="[10, 10]"
:use-css-transforms="true"
>
<grid-item class="grid-cell" v-for="item in layout" v-bind:id="item.i"
:x="item.x"
:y="item.y"
:w="item.w"
:h="item.h"
:i="item.i"
:key="item.i"
:min-h="9"
:min-w="3"
drag-allow-from=".header"
drag-ignore-from="item.i"
>
<div class="header">
<h5>{{item.name}}</h5>
</div>
</grid-item>
</grid-layout>
</div>
CSS
.vue-grid-layout {
background: #eee;
}
.vue-grid-item:not(.vue-grid-placeholder) {
background: #ccc;
border: 1px solid black;
}
.vue-grid-item.resizing {
opacity: 0.9;
}
.vue-grid-item.static {
background: #cce;
}
.vue-grid-item .text {
font-size: 24px;
text-align: center;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
height: 24px;
}
.vue-grid-item .minMax {
font-size: 12px;
}
.vue-grid-item .add {
cursor: pointer;
}
JavaScript
var jsonData = [{
"Color": {
"type": "string"
},
"M": {
"type": "month",
"caption": "Month"
},
"W": {
"type": "weekday",
"caption": "Week Day"
},
"Country": {
"type": "level",
"hierarchy": "Geography",
"level": "Country"
},
"State": {
"type": "level",
"hierarchy": "Geography",
"level": "State",
"parent": "Country"
},
"City": {
"type": "level",
"hierarchy": "Geography",
"parent": "State"
},
"Price": {
"type": "number"
},
"Quantity": {
"type": "number"
}
},
{
"Color": "green",
"M": "September",
"W": "Wed",
"Country": "Canada",
"State": "Ontario",
"City": "Toronto",
"Price": 174,
"Quantity": 22
},
{
"Color": "red",
"M": "March",
"W": "Mon",
"Country": "USA",
"State": "California",
"City": "Los Angeles",
"Price": 1664,
"Quantity": 19
},
{
"Color": "red",
"M": "January",
"W": "Mon",
"Country": "Canada",
"State": "Quebec",
"City": "Montreal",
"Price": 1190,
"Quantity": 292
},
{
"Color": "green",
"D": "04/08/2014",
"M": "August",
"W": "Fri",
"Country": "USA",
"State": "California",
"City": "Los Angeles",
"Price": 1222,
"Quantity": 730
},
{
"Color": "white",
"M": "March",
"W": "Wed",
"Country": "USA",
"State": "California",
"City": "Los Angeles",
"Price": 7941,
"Quantity": 73
},
{
"Color": "red",
"M": "August",
"W": "Wed",
"Country": "Canada",
"State": "Ontario",
"City": "Toronto",
"Price": 6829,
"Quantity": 19
},
{
"Color": "green",
"M": "January",
"W": "Wed",
"Country": "Canada",
"State": "Quebec",
"City": "Montreal",
"Price": 2995,
"Quantity": 98
},
{
"Color": "white",
"M": "February",
"W": "Mon",
"Country": "USA",
"State":...