";
return div.innerHTML.indexOf('
') > 0
}
// #3663: IE encodes newlines inside attribute values while other browsers don't
var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
// #6828: chrome encodes content in a[href]
var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
/* */
var idToTemplate = cached(function (id) {
var el = query(id);
return el && el.innerHTML
});
var mount = Vue.prototype.$mount;
Vue.prototype.$mount = function (
el,
hydrating
) {
el = el && query(el);
/* istanbul ignore if */
if (el === document.body || el === document.documentElement) {
warn(
"Do not mount Vue to or - mount to normal elements instead."
);
return this
}
var options = this.$options;
// resolve template/el and convert to render function
if (!options.render) {
var template = options.template;
if (template) {
if (typeof template === 'string') {
if (template.charAt(0) === '#') {
template = idToTemplate(template);
/* istanbul ignore if */
if (!template) {
warn(
("Template element not found or is empty: " + (options.template)),
this
);
}
}
} else if (template.nodeType) {
template = template.innerHTML;
} else {
{
warn('invalid template option:' + template, this);
}
return this
}
} else if (el) {
template = getOuterHTML(el);
}
if (template) {
/* istanbul ignore if */
if (config.performance && mark) {
mark('compile');
}
var ref = compileToFunctions(template, {
outputSourceRange: "development" !== 'production',
shouldDecodeNewlines: shouldDecodeNewlines,
shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
delimiters: options.delimiters,
comments: options.comments
}, this);
var render = ref.render;
var staticRenderFns = ref.staticRenderFns;
options.render = render;
options.staticRenderFns = staticRenderFns;
/* istanbul ignore if */
if (config.performance && mark) {
mark('compile end');
measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
}
}
}
return mount.call(this, el, hydrating)
};
/**
* Get outerHTML of elements, taking care
* of SVG elements in IE as well.
*/
function getOuterHTML (el) {
if (el.outerHTML) {
return el.outerHTML
} else {
var container = document.createElement('div');
container.appendChild(el.cloneNode(true));
return container.innerHTML
}
}
Vue.compile = compileToFunctions;
return Vue;
}));
================================================
FILE: website/docs/.vuepress/styles/index.styl
================================================
// placeholder for test, dont't remove it.
//.content {
// font-size 30px;
//}
//div.theme-default-content:not(.custom) { max-width: 100%; }
div.theme-default-content:not(.custom) { max-width: 1024px; }
/*
pre.vue-container
border-left-width: .5rem;
border-left-style: solid;
border-color: #42b983;
border-radius: 0px;
& > code
font-size: 14px !important;
& > p
margin: -5px 0 -20px 0;
code
background-color: #42b983 !important;
padding: 3px 5px;
border-radius: 3px;
color #000
em
color #808080
font-weight light
*/
================================================
FILE: website/docs/.vuepress/theme/components/CarbonAds.vue
================================================
================================================
FILE: website/docs/.vuepress/theme/components/Home.vue
================================================
{{ data.heroText || $title || 'Hello' }}
{{ feature.title }}
{{ feature.details }}
================================================
FILE: website/docs/.vuepress/theme/index.js
================================================
module.exports = {
extend: '@vuepress/theme-default'
}
================================================
FILE: website/docs/.vuepress/theme/layouts/Layout.vue
================================================
================================================
FILE: website/docs/README.md
================================================
---
layout: HomeLayout
home: true
heroImage: /assets/img/logo.png
heroText: Vue Grid Layout
tagline: A grid layout system for Vue.js, like
Gridster, for Vue.js. Heavily inspired by
React-Grid-Layout
actionText: Get Started →
actionLink: /guide/
features:
- title: ✥ Draggable widgets
details:
- title: ⇲ Resizable widgets
details:
- title: Static widgets
details:
- title: Bounds checking for dragging and resizing
details:
- title: Widgets can be added or removed without rebuilding grid
details:
- title: Layout can be serialized and restored
details:
- title: Automatic RTL support (resizing not working with RTL on 2.2.0)
details:
- title: Responsive
details:
- title: Min/max w/h per item
details:
---
================================================
FILE: website/docs/changelog/README.md
================================================
---
sidebar: auto
---
# Changelog
## 2.4.0 (Aug 3, 2022)
* GridLayout transformScale prop, to allow proper dragging and resizing when scaled (#430) (thanks [adt-hgkim](https://github.com/adt-hgkim))
* GridLayout and GridItem isBounded prop, to prevent draging outside of the parent element (#523) (thanks [rin4ik](https://github.com/rin4ik))
* Added GridItem passthrough options for interact resizable and draggable (#181) (thanks [llezenelrahc](https://github.com/llezenelrahc))
* Change function call order for responsive features (thanks [william8012](https://github.com/william8012))
* Added GridLayout restoreOnDrag prop, to generate less gaps on drag when verticalCompact is false (thanks [jledentu](https://github.com/jledentu))
* added unit tests (thanks [ygj6](https://github.com/ygj6))
* layout key extra validations (thanks [ygj6](https://github.com/ygj6))
* Fix grid items overlapping when using autoSize() (thanks [ygj6](https://github.com/ygj6) and [savandriy](https://github.com/savandriy))
## 2.3.12 (Jan 15, 2020)
* Bumped interact.js to 1.10.2
* Added 'preserveAspectRatio' property to GridItem (thanks [validide](https://github.com/validide))
## 2.3.11 (Oct 13, 2020)
* fix: regression when using responsive layout (#487)
## 2.3.10 (Oct 12, 2020)
* Bumped interact.js to 1.10.0, now imported as ES6 modules to optimize size
* fix: resizing a grid item in RTL mode wasn't working (thanks [or-lat](https://github.com/or-lat))
* Added GridLayout.useStyleCursor property to fix possible browser freezes (thanks [mosuzi](https://github.com/mosuzi))
* fix: wrong parent layout when GridItem is not the child of GridLayout (thanks [lzq4047](https://github.com/lzq4047))
* Fix: Item's size changes when hiding/displaying it again in responsive mode (thanks [lustan3216](https://github.com/lustan3216))
## 2.3.9 (Sep 28, 2020)
* Fix plugin installation (fixes #311) (thanks [yfwz100](https://github.com/yfwz100))
* Bumped interact.js to 1.9.22
## 2.3.8 (July 31, 2020)
* Make margins reactive (thanks [yfwz100](https://github.com/yfwz100))
* Added missing 'layout-updated' events (thanks [ben-lau](https://github.com/ben-lau))
* Support for initial responsive layouts and breakpoint change event (thanks [ftylitak](https://github.com/ftylitak))
* Bugfix for possible error when layout items get removed and interactObj is not set (thanks [Tofandel](https://github.com/Tofandel))
* Fix wrong grid item sorting in responsive mode (thanks [pieterbeulque](https://github.com/pieterbeulque))
## 2.3.7 (Oct 31, 2019)
* renamed 'resized' event emitted when the container changes size (browser window or other), introduced in #337, fixes #358
* bugfix on layout-ready event
## 2.3.6 (Sep 11, 2019)
* reverted grid item w and h previous rounding change, fixes #355
## 2.3.5 (Sep 7, 2019)
* Fix: no-touch on mobile and only if item is draggable or resizable (thanks [DGoms](https://github.com/DGoms)).
* Prevent collision feature (thanks [SheanDe](https://github.com/SheanDe)).
* Simplified Chinese README (thanks [harrywangchina](https://github.com/harrywangchina)).
* 'resized' event now emitted if grid item is resized due to changes other than a manual resize (e.g. browser window resize) (thanks [pmorch](https://github.com/pmorch)).
* Improvement on 'layout-ready' event emit (thanks [pmorch](https://github.com/pmorch)).
* Added watchers for min/max height and width (thanks [grinat](https://github.com/grinat)).
* Improvement: make sure the size of grid-item is bigger than the slot-item (thanks [ywmail](https://github.com/ywmail)).
## 2.3.4 (Mar 5, 2019)
* Support for static items (thanks [panjiangyi](https://github.com/panjiangyi)).
* RTL bugfix (thanks [irvingwa](https://github.com/irvingwa)).
* Memory leak fixes (thanks [aiankile](https://github.com/aiankile)).
* Fixed exception on grid layout mount (thanks [BenoitZugmeyer](https://github.com/BenoitZugmeyer)).
* Fixed overlapping and resizing bugs on responsive mode (thanks [shpfive](https://github.com/shpfive)).
* Added new events emited by GridLayout (layout-created, layout-before-mount, layout-mounted, layout-ready) (thanks [samuelmolinski](https://github.com/samuelmolinski)).
## 2.3.3 (Dec 26, 2018)
* Reverted adding vue as external, which caused problems loading umd.
## 2.3.2 (Dec 13, 2018)
* Added vue as externals webpack config to fix startup problems (thanks [Micene9](https://github.com/Micene09))
## 2.3.1 (Nov 6, 2018)
* Previous fix for touch dragging on Android broke dragging on other mobile browsers (thanks [onx2](https://github.com/onx2))
## 2.3.0 (Oct 26, 2018)
* Responsive layout support (thanks [shpfive](https://github.com/shpfive))
* Fix for touch dragging on Android (thanks [pbabey](https://github.com/pbabey))
## 2.2.0 (Sep 10, 2018)
* changed project structure and build using Vue CLI
* GridItem new autosize method. For now, need to be called from child component with this.$parent.autoSize() (thanks[mech01nc01](https://github.com/mech01nc01))
* Abstract DOM related calls for initial SSR Support (thanks[Kukks](https://github.com/Kukks))
* GridItem.i can now be a number or a string (thanks[xch1029](https://github.com/xch1029))
* Use interactjs size restrictions to limit resizing (thanks[LuisCarreras](https://github.com/LuisCarreras))
* Fixed interactjs instance leak on instance release (thanks[zzuligy](https://github.com/zzuligy))
## 2.1.13 (May 2, 2018)
* Resize event now also emits dimensions in pixels (thanks [buremba](https://github.com/buremba))
* Support for dynamic col-num (#121) (thanks [ittus](https://github.com/ittus))
## 2.1.12 (Fev 27, 2018)
* Updated interact.js to 1.3.3 (#144)
## 2.1.11 (Jan 5, 2018)
* Fixed issue with multiple grids on same vm (#134) (thanks [Suen](https://github.com/sunzongzheng))
* Fixed issue with layout update on reassignment (#130) (thanks [daizengyu](https://github.com/daizengyu123))
## 2.1.10 (Dec 15, 2017)
* Fixed possible bug related with #119
* Changed css translate to translate3d (#96)
* Added is-mirrored config, allowing the grid items to be rendered from right to left (horizontal flip) (thanks [kweij](https://github.com/kweij))
* Added grid updated event for easier integration with vuex (thanks [SergeyKhval](https://github.com/SergeyKhval))
## 2.1.9 (Aug 17, 2017)
* Fixed local module reference to interact.js
## 2.1.8 (Aug 17, 2017)
* Fixed #61 and #37
* Fixed #82
* Fixed #87
## 2.1.7 (Aug 17, 2017)
* Fixed #59
* Fixed #83
* Implemented support for dragAllowFrom and dragIgnoreFrom props on GridItem (thanks [ThePlastic](https://github.com/ThePlastic))
## 2.1.6 (Apr 6, 2017)
* Fixed #43, configurable drag elements ignore on grid item contents (thanks [neithere](https://github.com/neithere))
* Fix for getLayoutItem, sometimes returns null elements (thanks [pbabey](https://github.com/pbabey))
## 2.1.5 (Mar 24, 2017)
* Really fixed #22 #32, multiple grid instances were not working properly in 2.1.4
* resizedEvent now also returns item width and height in pixels (implements #34)
## 2.1.4 (Mar 20, 2017)
* Implemented #32, support for multiple grid instances on the same page
## 2.1.3 (Mar 9, 2017)
* Fixed #27, props mutation warnings
## 2.1.2 (Fev 16, 2017)
* Implemented #12, buttons on GridItems would trigger drag on mobile
* Implemented #24, listeners removal beforeDestroy (thanks [pbabey](https://github.com/pbabey))
## 2.1.1 (Fev 9, 2017)
* Implemented #13, dynamic row height update support
* Implemented #23, dynamic enable/disable dragging and resizing support
* Implemented #21, moved and resized events
## 2.1.0 (Fev 6, 2017)
* RTL support (thanks [easteregg](https://github.com/easteregg))
* Move and resize events (thanks [ThePlastic](https://github.com/ThePlastic))
================================================
FILE: website/docs/guide/01-basic.md
================================================
# 01 - Basic
[View source](https://github.com/jbaysolutions/vue-grid-layout/blob/master/website/docs/.vuepress/components/Example01Basic.vue)
================================================
FILE: website/docs/guide/02-events.md
================================================
# 02 - Move and resize events
[View source](https://github.com/jbaysolutions/vue-grid-layout/blob/master/website/docs/.vuepress/components/Example02Events.vue)
================================================
FILE: website/docs/guide/03-multiple-grids.md
================================================
# 03 - Multiple grids
[View source](https://github.com/jbaysolutions/vue-grid-layout/blob/master/website/docs/.vuepress/components/Example03MultipleGrids.vue)
================================================
FILE: website/docs/guide/04-allow-ignore.md
================================================
# 04 - Drag allow/ignore elements
Ignore drag on certain elements and allow on others.
Click and drag the dots on the corner of each item to reposition
[View source](https://github.com/jbaysolutions/vue-grid-layout/blob/master/website/docs/.vuepress/components/Example04AllowIgnore.vue)
================================================
FILE: website/docs/guide/05-mirrored.md
================================================
# 05 - Mirrored grid layout
[View source](https://github.com/jbaysolutions/vue-grid-layout/blob/master/website/docs/.vuepress/components/Example05Mirrored.vue)
================================================
FILE: website/docs/guide/06-responsive.md
================================================
# 06 - Responsive
[View source](https://github.com/jbaysolutions/vue-grid-layout/blob/master/website/docs/.vuepress/components/Example06Responsive.vue)
================================================
FILE: website/docs/guide/07-prevent-collision.md
================================================
# 07 - Prevent Collision
[View source](https://github.com/jbaysolutions/vue-grid-layout/blob/master/website/docs/.vuepress/components/Example07PreventCollision.vue)
================================================
FILE: website/docs/guide/08-responsive-predefined-layouts.md
================================================
# 08 - Responsive with predefined layouts
[View source](https://github.com/jbaysolutions/vue-grid-layout/blob/master/website/docs/.vuepress/components/Example08ResponsivePredefinedLayouts.vue)
================================================
FILE: website/docs/guide/09-dynamic-add-remove.md
================================================
# 09 - Dynamic Add/Remove
[View source](https://github.com/jbaysolutions/vue-grid-layout/blob/master/website/docs/.vuepress/components/Example09DynamicAddRemove.vue)
================================================
FILE: website/docs/guide/10-drag-from-outside.md
================================================
# 10 - Drag From Outside
This demo shows what happens when an item is added from outside of the grid.
Once you drop the item within the grid you'll get its coordinates/properties and can perform actions with it accordingly.
[View source](https://github.com/jbaysolutions/vue-grid-layout/blob/master/website/docs/.vuepress/components/Example10DragFromOutside.vue)
================================================
FILE: website/docs/guide/11-bounded.md
================================================
# 11 - Dragging grid items bounded to grid container
[View source](https://github.com/jbaysolutions/vue-grid-layout/blob/master/website/docs/.vuepress/components/Example11Bounded.vue)
================================================
FILE: website/docs/guide/README.md
================================================
# Installation
## NPM
npm install vue-grid-layout --save
## Yarn
yarn add vue-grid-layout
Import the library
```javascript
import VueGridLayout from 'vue-grid-layout';
```
Add to other Vue components
```javascript
export default {
components: {
GridLayout: VueGridLayout.GridLayout,
GridItem: VueGridLayout.GridItem
},
// ... data, methods, mounted (), etc.
}
```
## browser
Include the browser-ready bundle (download from [releases](https://github.com/jbaysolutions/vue-grid-layout/releases)) in your page. The components will be automatically available.
```html
```
================================================
FILE: website/docs/guide/auto-size.md
================================================
# Auto Sizing Grid Items
TODO: https://github.com/jbaysolutions/vue-grid-layout/issues/351
================================================
FILE: website/docs/guide/events.md
================================================
# Events
Move and resize event listeners can be added to each grid-item, so that the parent Vue can be notified when a grid element is being moved or resized.
Moved and resized event listeners can be added, if the only notification needed is when an item is finished moving or resizing.
Working example [here](../guide/02-events.md)
````html
{{item.i}}
````
## GridLayout
### layoutCreatedEvent
Layout created event
Emited on the component created lifecycle hook
```javascript
layoutCreatedEvent: function(newLayout){
console.log("Created layout: ", newLayout)
}
```
### layoutBeforeMountEvent
Layout beforeMount event
Emited on the component beforeMount lifecycle hook
```javascript
layoutBeforeMountEvent: function(newLayout){
console.log("beforeMount layout: ", newLayout)
}
```
### layoutMountedEvent
Layout mounted event
Emited on the component mounted lifecycle hook
```javascript
layoutMountedEvent: function(newLayout){
console.log("Mounted layout: ", newLayout)
}
```
### layoutReadyEvent
Layout ready event
Emited when all the operations on the mount hook finish
```javascript
layoutReadyEvent: function(newLayout){
console.log("Ready layout: ", newLayout)
}
```
### layoutUpdatedEvent
Layout updated event
Every time the layout has finished updating and positions of all grid-items are recalculated
```javascript
layoutUpdatedEvent: function(newLayout){
console.log("Updated layout: ", newLayout)
}
```
### breakpointChangedEvent
Breakpoint Changed event
Every time the breakpoint value changes due to window resize
```javascript
/**
*
* @param newBreakpoint the breakpoint name
* @param newLayout the chosen layout for the breakpoint
*
*/
breakpointChangedEvent: function(newBreakpoint, newLayout){
console.log("BREAKPOINT CHANGED breakpoint=", newBreakpoint, ", layout: ", newLayout );
},
```
## GridItem
### moveEvent
Move event
Every time an item is being moved and changes position
```javascript
moveEvent: function(i, newX, newY){
console.log("MOVE i=" + i + ", X=" + newX + ", Y=" + newY);
},
```
### resizeEvent
Resize event
Every time an item is being resized and changes size
```javascript
resizeEvent: function(i, newH, newW, newHPx, newWPx){
console.log("RESIZE i=" + i + ", H=" + newH + ", W=" + newW + ", H(px)=" + newHPx + ", W(px)=" + newWPx);
},
```
### movedEvent
Moved event
Every time an item is finished being moved and changes position
```javascript
movedEvent: function(i, newX, newY){
console.log("MOVED i=" + i + ", X=" + newX + ", Y=" + newY);
},
```
### resizedEvent
Resized event
Every time an item is finished being resized and changes size
```javascript
/**
*
* @param i the item id/index
* @param newH new height in grid rows
* @param newW new width in grid columns
* @param newHPx new height in pixels
* @param newWPx new width in pixels
*
*/
resizedEvent: function(i, newH, newW, newHPx, newWPx){
console.log("RESIZED i=" + i + ", H=" + newH + ", W=" + newW + ", H(px)=" + newHPx + ", W(px)=" + newWPx);
},
```
### containerResizedEvent
Container Resized event
Every time the grid item/layout container changes size (browser window or other)
```javascript
/**
*
* @param i the item id/index
* @param newH new height in grid rows
* @param newW new width in grid columns
* @param newHPx new height in pixels
* @param newWPx new width in pixels
*
*/
containerResizedEvent: function(i, newH, newW, newHPx, newWPx){
console.log("CONTAINER RESIZED i=" + i + ", H=" + newH + ", W=" + newW + ", H(px)=" + newHPx + ", W(px)=" + newWPx);
},
```
================================================
FILE: website/docs/guide/examples.md
================================================
# Examples
## Basic
## Events
## Multiple Grids
## Drag allow/ignore elements
Ignore drag on certain elements and allow on on others.
Click and drag the dots on the corner of each item to reposition
================================================
FILE: website/docs/guide/properties.md
================================================
# Properties
## GridLayout
### layout
* type: `Array`
* required: `true`
This is the initial layout of the grid.
The value must be an `Array` of `Object` items. Each item must have `i`, `x`, `y`, `w` and `h` properties. Please refer to the documentation for `GridItem` below for more information.
### responsiveLayouts
* type: `Object`
* required: `false`
* default : `{}`
This is the initial layouts of the grid per breakpoint if `responsive` is set to `true`.
The keys of the `Object` are breakpoint names and each value is an `Array` of `Object` items as defined by `layout` prop. eg:{ lg:[layout items], md:[layout items] }.
Setting the prop after the creation of the GridLayout has no effect.
See also [responsive](#responsive), [breakpoints](#breakpoints) and [cols](#cols)
### colNum
* type: `Number`
* required: `false`
* default: `12`
Says how many columns the grid has.
The value should be a _natural number_.
### rowHeight
* type: `Number`
* required: `false`
* default: `150`
Says what is a height of a single row in pixels.
### maxRows
* type: `Number`
* required: `false`
* default: `Infinity`
Says what is a maximal number of rows in the grid.
### margin
* type: `Array`
* required: `false`
* default: `[10, 10]`
Says what are the margins of elements inside the grid.
The value must be a two-element `Array` of `Number`. Each value is expressed in pixels. The first element is a margin horizontally, the second element is a vertical margin.
### isDraggable
* type: `Boolean`
* required: `false`
* default: `true`
Says if the grids items are draggable.
### isResizable
* type: `Boolean`
* required: `false`
* default: `true`
Says if the grids items are resizable.
### isMirrored
* type: `Boolean`
* required: `false`
* default: `false`
Says if the RTL/LTR should be reversed.
### isBounded
* type: `Boolean`
* required: `false`
* default: `false`
Says if the grid items are bounded to the container when dragging
### autoSize
* type: `Boolean`
* required: `false`
* default: `true`
Says if the container height should swells and contracts to fit contents.
### verticalCompact
* type: `Boolean`
* required: `false`
* default: `true`
Says if the layout should be compact vertically.
### restoreOnDrag
* type: `Boolean`
* required: `false`
* default: `false`
Says if the moved grid items should be restored after an item has been dragged over.
### preventCollision
* type: `Boolean`
* required: `false`
* default: `false`
Says if grid items will move when being dragged over.
### useCssTransforms
* type: `Boolean`
* required: `false`
* default: `true`
Says if the CSS `transition-property: transform;` should be used.
### responsive
* type: `Boolean`
* required: `false`
* default: `false`
Says if the layout should be responsive to window width
See also [responsiveLayouts](#responsivelayouts), [breakpoints](#breakpoints) and [cols](#cols)
### breakpoints
* type: `Object`
* required: `false`
* default: { lg: 1200, md: 996, sm: 768, xs: 480, xxs: 0 }
Breakpoints defined for responsive layout, the parameter represents the width of different devices:lg(large), md(medium), sm(small), xs(extra small). Sets widths on wich column number changes
See also [responsiveLayouts](#responsivelayouts) and [cols](#cols)
### cols
* type: `Object`
* required: `false`
* default: { lg: 12, md: 10, sm: 6, xs: 4, xxs: 2 }
Defines number of columns for each breakpoint
### useStyleCursor
* type: `Boolean`
* required: `false`
* default: `true`
Says if set the `styleCursor` option to true. When dragging freezes, setting this value to `false` may alleviate problems.
**This property is not reactive**
### transformScale
* type: `Number`
* required: `false`
* default: 1
Sets a scaling factor to the size of the grid items, 1 is 100%
## GridItem
### i
* type: `String`
* required: `true`
This is the unique identifier of the item.
### x
* type: `Number`
* required: `true`
Says what is a initial horizontal position of the item (in which column it should be placed).
The value must be a _whole number_.
### y
* type: `Number`
* required: `true`
Says what is a initial vertical position of the item (in which row it should be placed).
The value must be a _whole number_.
### w
* type: `Number`
* required: `true`
Says what is a initial width of the item.
The value is a number that is multiplied by `colWidth`.
### h
* type: `Number`
* required: `true`
Says what is a initial height of the item.
The value is a number that is multiplied by `rowHeight`.
### minW
* type: `Number`
* required: `false`
* default: `1`
Says what is a minimal width of the item. If `w` will be smaller then `minW` then `w` will be set to `minW`.
The value is a number that is multiplied by `colWidth`.
### minH
* type: `Number`
* required: `false`
* default: `1`
Says what is a minimal hieght of the item. If `h` will be smaller then `minH` then `h` will be set to `minH`.
The value is a number that is multiplied by `rowHeight`.
### maxW
* type: `Number`
* required: `false`
* default: `Infinity`
Says what is a maximal width of the item. If `w` will be bigger then `maxW` then `w` will be set to `maxW`.
The value is a number that is multiplied by `colWidth`.
### maxH
* type: `Number`
* required: `false`
* default: `Infinity`
Says what is a maximal height of the item. If `h` will be bigger then `maxH` then `h` will be set to `maxH`.
The value is a number that is multiplied by `rowHeight`
### isDraggable
* type: `Boolean`
* required: `false`
* default: `null`
Says if item is draggable.
If default value is `null` then it's inherited from parent.
### isResizable
* type: `Boolean`
* required: `false`
* default: `null`
Says if item is resizable.
If default value is `null` then it's inherited from parent.
### isBounded
* type: `Boolean`
* required: `false`
* default: `null`
Says if the item is bounded to the container when dragging.
If default value is `null` then it's inherited from parent.
### static
* type: `Boolean`
* required: `false`
* default: `false`
Says if item is static (won't be draggable, resizable or moved by other items).
### dragIgnoreFrom
* type: `String`
* required: `false`
* default: `'a, button'`
Says which elements of the item shouldn't trigger drag event of the item.
The value is `css-like` selector string.
For more info please refer to `ignoreFrom` in [interact.js docs](http://interactjs.io/docs/#ignorable-selectors).
### dragAllowFrom
* type: `String`
* required: `false`
* default: `null`
Says which elements of the item should trigger drag event of the item.
The value is `css-like` selector string.
If `null` then one can drag by any (excluding `dragIgnoreFrom`) element of the item.
For more info please refer to `allowFrom` in [interact.js docs](http://interactjs.io/docs/#ignorable-selectors).
### resizeIgnoreFrom
* type: `String`
* required: `false`
* default: `'a, button'`
Says which elements of the item shouldn't trigger resize event of the item.
The value is `css-like` selector string.
For more info please refer to `ignoreFrom` in [interact.js docs](http://interactjs.io/docs/#ignorable-selectors).
### preserveAspectRatio
* type: `Boolean`
* required: `false`
* default: `false`
If 'true', forces the GridItem to preserve its aspect ratio when resizing.
### dragOption
* type: `Object`
* required: `false`
* default: `{}`
Passthrough object for the grid item [interact.js draggable configuration](https://interactjs.io/docs/draggable/)
### resizeOption
* type: `Object`
* required: `false`
* default: `{}`
Passthrough object for the grid item [interact.js resizable configuration](https://interactjs.io/docs/resizable/)
================================================
FILE: website/docs/guide/styling.md
================================================
# Styling
Grid styling can be customized to fit your needs. Below is a list of the classes you can override.
## Placeholder
The default css for the placeholder is:
````css
.vue-grid-item.vue-grid-placeholder {
background: red;
opacity: 0.2;
transition-duration: 100ms;
z-index: 2;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-o-user-select: none;
user-select: none;
}
````
You can override the properties using the !important rule:
````css
.vue-grid-item.vue-grid-placeholder {
background: green !important;
}
````
Or by wrapping your grid with a more [specific](https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity) class:
````css
.container .vue-grid-item.vue-grid-placeholder {
background: green;
}
````
In this example we change the placeholder background color to green:
[View source](https://github.com/jbaysolutions/vue-grid-layout/blob/master/website/docs/.vuepress/components/ExampleStylingPlaceholder.vue)
## Grid lines
To add grid lines to the layout, add the ``grid`` class to the grid-layout element and use the css:
````css
.grid::before {
content: '';
background-size: calc(calc(100% - 5px) / 12) 40px;
background-image: linear-gradient(
to right,
lightgrey 1px,
transparent 1px
),
linear-gradient(to bottom, lightgrey 1px, transparent 1px);
height: calc(100% - 5px);
width: calc(100% - 5px);
position: absolute;
background-repeat: repeat;
margin:5px;
}
````
CSS calculations for grid lines:
* background size = calc(calc(100% - (margin/2)) / colNum) rowHeight + margin;
* height: calc(100% - (margin/2))
* width: calc(100% - (margin/2))
* margin: margin / 2
[View source](https://github.com/jbaysolutions/vue-grid-layout/blob/master/website/docs/.vuepress/components/ExampleStylingGridLines.vue)
Work in progress...
================================================
FILE: website/docs/guide/usage.md
================================================
# Usage
```javascript
new Vue({
el: '#app',
data: {
layout: [
{"x":0,"y":0,"w":2,"h":2,"i":"0"},
{"x":2,"y":0,"w":2,"h":4,"i":"1"},
{"x":4,"y":0,"w":2,"h":5,"i":"2"},
{"x":6,"y":0,"w":2,"h":3,"i":"3"},
{"x":8,"y":0,"w":2,"h":3,"i":"4"},
{"x":10,"y":0,"w":2,"h":3,"i":"5"},
{"x":0,"y":5,"w":2,"h":5,"i":"6"},
{"x":2,"y":5,"w":2,"h":5,"i":"7"},
{"x":4,"y":5,"w":2,"h":5,"i":"8"},
{"x":6,"y":3,"w":2,"h":4,"i":"9"},
{"x":8,"y":4,"w":2,"h":4,"i":"10"},
{"x":10,"y":4,"w":2,"h":4,"i":"11"},
{"x":0,"y":10,"w":2,"h":5,"i":"12"},
{"x":2,"y":10,"w":2,"h":5,"i":"13"},
{"x":4,"y":8,"w":2,"h":4,"i":"14"},
{"x":6,"y":8,"w":2,"h":4,"i":"15"},
{"x":8,"y":10,"w":2,"h":5,"i":"16"},
{"x":10,"y":4,"w":2,"h":2,"i":"17"},
{"x":0,"y":9,"w":2,"h":3,"i":"18"},
{"x":2,"y":6,"w":2,"h":2,"i":"19"}
],
},
});
```
```html
{{item.i}}
```
================================================
FILE: website/docs/zh/README.md
================================================
---
layout: HomeLayout
home: true
heroImage: /assets/img/logo.png
heroText: Vue Grid Layout
tagline: 一个类似于
Gridster的栅格布局系统, 适用于Vue.js。灵感源自于
React-Grid-Layout
actionText: 开始 →
actionLink: /zh/guide/
features:
- title: ✥ 可拖拽
details:
- title: ⇲ 可调整大小
details:
- title: 静态部件(不可拖拽、调整大小)
details:
- title: 拖拽和调整大小时进行边界检查
details:
- title: 增减部件时避免重建栅格
details:
- title: 可序列化和还原的布局
details:
- title: 自动化 RTL 支持
details:
- title: 响应式
details:
- title: Min/max w/h per item
details:
---
================================================
FILE: website/docs/zh/changelog/README.md
================================================
---
sidebar: auto
---
# 更新日志
## 2.4.0(2022年08月03日)
* TODO
## 2.3.12(2021年01月15日)
* 将interact.js升级到1.10.2
* 向GridItem添加了'preserveAspectRatio'属性 (感谢 [validide](https://github.com/validide))
## 2.3.11(2020年10月13日)
* 已修复:使用响应式布局时的回归(#487)
## 2.3.10(2020年10月12日)
* 将interact.js升级到1.10.0,现在作为ES6模块导入以优化大小
* 已修复:在RTL模式下无法调整栅格元素的大小 (感谢 [or-lat](https://github.com/or-lat))
* 添加了GridLayout.useStyleCursor属性以修复可能的浏览器冻结 (感谢 [mosuzi](https://github.com/mosuzi))
* 已修复:当GridItem不是GridLayout的子级时,父布局错误 (感谢 [lzq4047](https://github.com/lzq4047))
* 已修复:在响应模式下再次隐藏/显示元素时,元素的大小发生变化 (感谢 [lustan3216](https://github.com/lustan3216)))
## 2.3.9(2020年9月28日)
* 已修复插件安装(已修复#311) (感谢 [yfwz100](https://github.com/yfwz100))
* interact.js升级版本至1.9.22
## 2.3.8(2020年7月31日)
* 支持动态修改margin属性 (感谢 [yfwz100](https://github.com/yfwz100))
* 添加了丢失的“布局更新”事件 (感谢 [ben-lau](https://github.com/ben-lau))
* 支持初始响应式布局和断点更改事件 (感谢 [ftylitak](https://github.com/ftylitak))
* 修正了布局项被删除且未设置interactObj时可能出现的错误 (感谢 [Tofandel](https://github.com/Tofandel))
* 在响应模式下修复错误的栅格元素排序 (感谢 [pieterbeulque](https://github.com/pieterbeulque))
## 2.3.7(2019年10月31日)
* 在#337中引入容器更改大小(浏览器窗口或其他大小)时发出的重命名“调整大小”事件,在#358已修复
* 已修复layout-ready事件
## 2.3.6(2019年9月11日)
* 恢复栅格元素w和h先前的舍入更改,已修复#355
## 2.3.5(2019年9月7日)
* 已修复:在移动设备上无触摸,并且仅当元素可拖动或可调整大小时 (感谢 [DGoms](https://github.com/DGoms))。
* 防止碰撞功能 (感谢 [SheanDe](https://github.com/SheanDe))。
* 简体中文README (感谢 [harrywangchina](https://github.com/harrywangchina))。
* 如果由于除手动调整大小(例如,浏览器窗口调整大小)以外的更改而调整了栅格项的大小,则此时将发出`resized`事件 (感谢 [pmorch](https://github.com/pmorch))。
* 改进`layout-ready`触发事件 (感谢 [pmorch](https://github.com/pmorch))。
* 添加了min/max height and width的监视程序 (感谢 [grinat](https://github.com/grinat))。
* 改进:确保grid-item的大小大于slot-item (感谢 [ywmail](https://github.com/ywmail))。
## 2.3.4(2019年3月5日)
* 支持静态部件 (感谢 [panjiangyi](https://github.com/panjiangyi))。
* RTL错误修正 (感谢 [irvingwa](https://github.com/irvingwa))。
* 内存泄漏修复 (感谢 [aiankile](https://github.com/aiankile))。
* 已修复了栅格布局安装上的异常 (感谢 [BenoitZugmeyer](https://github.com/BenoitZugmeyer))。
* 已修复了响应模式下重叠和调整大小的错误 (感谢 [shpfive](https://github.com/shpfive))。
* 添加了GridLayout发出的新事件 (layout-created, layout-before-mount,layout-mounted,layout-ready) (感谢 [samuelmolinski](https://github.com/samuelmolinski))。
## 2.3.3(2018年12月26日)
* 恢复了将vue作为外部添加,这导致加载umd时出现问题。
## 2.3.2(2018年12月13日)
* 添加了vue作为外部webpack配置以修复启动问题 (感谢 [Micene9](https://github.com/Micene09))
## 2.3.1(2018年11月6日)
* 之前在Android上进行触摸拖动的修复方法打破了在其他移动浏览器上的拖动 (感谢 [onx2](https://github.com/onx2))
## 2.3.0(2018年10月26日)
* 响应式布局支持 (感谢 [shpfive](https://github.com/shpfive))
* 已修复了在Android上进行触摸拖动的问题 (感谢 [pbabey](https://github.com/pbabey))
## 2.2.0(2018年9月10日)
* 使用Vue CLI更改了项目结构并进行了构建
* GridItem新的autosize方法。现在,需要使用this.$parent.autoSize()从子组件中调用 (感谢 [mech01nc01](https://github.com/mech01nc01))
* 抽象的DOM相关要求提供初始SSR支持 (感谢 [Kukks](https://github.com/Kukks))
* GridItem.i现在可以是数字或字符串 (感谢 [xch1029](https://github.com/xch1029))
* 使用interactjs大小来限制调整大小 (感谢 [LuisCarreras](https://github.com/LuisCarreras))
* 已修复了实例释放时的interactjs实例泄漏 (感谢 [zzuligy](https://github.com/zzuligy))
## 2.1.13(2018年5月2日)
* 调整大小事件现在也发出以像素为单位的尺寸 (感谢 [buremba](https://github.com/buremba))
* 支持动态列修改(#121) (感谢 [ittus](https://github.com/ittus))
## 2.1.12(2018年2月27日)
* 将interact.js更新为1.3.3 (#144)
## 2.1.11(2018年1月5日)
* 解决了同一个虚拟机(#134)上有多个栅格的问题 (感谢 [Suen](https://github.com/sunzongzheng))
* 解决了重新分配时布局更新的问题(#130) (感谢 [daizengyu](https://github.com/daizengyu123))
## 2.1.10(2017年12月15日)
* 已修复了与#119相关的可能错误
* 将CSS转换为Translation3D(#96)
* 添加了is-mirrored配置,允许从右向左渲染栅格元素(水平翻转) (感谢 [kweij](https://github.com/kweij))
* 添加了栅格更新事件,可以更轻松地与vuex集成 (感谢 [SergeyKhval](https://github.com/SergeyKhval))
## 2.1.9(2017年8月17日)
* 已修复了对interact.js的本地模块引用
## 2.1.8(2017年8月17日)
* 已修复#61、#37
* 已修复#82
* 已修复#87
## 2.1.7(2017年8月17日)
* 已修复#59
* 已修复#83
* 对GridItem中props的dragAllowFrom和dragIgnoreFrom实现了支持 (感谢 [ThePlastic](https://github.com/ThePlastic))
## 2.1.6(2017年4月6日)
* 已修复#43,配置拖曳元件上的栅格项内容忽略 (感谢 [neithere](https://github.com/neithere))
* 已修复了getLayoutItem,有时返回null元素 (感谢 [pbabey](https://github.com/pbabey))
## 2.1.5(2017年3月24日)
* 真正修复#22、#32,多个栅格实例在2.1.4中无法正常工作
* resizeEvent现在还以像素为单位返回元素的宽度和高度(实现#34)
## 2.1.4(2017年3月20日)
* 实现#32,在同一页面上支持多个栅格实例
## 2.1.3(2017年3月9日)
* 已修复#27, props属性突变告警
## 2.1.2(2017年2月16日)
* 实现#12,GridItems上的按钮将触发移动设备上的拖动
* 实现#24,在销毁之前删除监听 (感谢 [pbabey](https://github.com/pbabey))
## 2.1.1(2017年2月9日)
* 实现#13,支持行高动态更新
* 实现#23,支持动态启用/禁用拖动和调整大小
* 实现#21,移动并调整大小的事件
## 2.1.0(2017年2月6日)
* RTL支持 (感谢 [easteregg](https://github.com/easteregg))
* 移动和调整事件大小 (感谢 [ThePlastic](https://github.com/ThePlastic))
================================================
FILE: website/docs/zh/guide/01-basic.md
================================================
# 01 - 基本
[查看资料](https://github.com/jbaysolutions/vue-grid-layout/blob/master/website/docs/.vuepress/components/Example01Basic.vue)
================================================
FILE: website/docs/zh/guide/02-events.md
================================================
# 02 - 移动事件并调整大小
[查看资料](https://github.com/jbaysolutions/vue-grid-layout/blob/master/website/docs/.vuepress/components/Example02Events.vue)
================================================
FILE: website/docs/zh/guide/03-multiple-grids.md
================================================
# 03 - 多个栅格
[查看资料](https://github.com/jbaysolutions/vue-grid-layout/blob/master/website/docs/.vuepress/components/Example03MultipleGrids.vue)
================================================
FILE: website/docs/zh/guide/04-allow-ignore.md
================================================
# 04 - 拖动允许/忽略元素
忽略对某些元素的拖动而对其他元素的允许。
单击并拖动每个项目角上的点以重新定位
[查看资料](https://github.com/jbaysolutions/vue-grid-layout/blob/master/website/docs/.vuepress/components/Example04AllowIgnore.vue)
================================================
FILE: website/docs/zh/guide/05-mirrored.md
================================================
# 05 - 镜像反转栅格布局
[查看资料](https://github.com/jbaysolutions/vue-grid-layout/blob/master/website/docs/.vuepress/components/Example05Mirrored.vue)
================================================
FILE: website/docs/zh/guide/06-responsive.md
================================================
# 06 - 响应式
[查看资料](https://github.com/jbaysolutions/vue-grid-layout/blob/master/website/docs/.vuepress/components/Example06Responsive.vue)
================================================
FILE: website/docs/zh/guide/07-prevent-collision.md
================================================
# 07 - 防止碰撞
[查看资料](https://github.com/jbaysolutions/vue-grid-layout/blob/master/website/docs/.vuepress/components/Example07PreventCollision.vue)
================================================
FILE: website/docs/zh/guide/08-responsive-predefined-layouts.md
================================================
# 08 - 响应预定义的布局
[查看资料](https://github.com/jbaysolutions/vue-grid-layout/blob/master/website/docs/.vuepress/components/Example08ResponsivePredefinedLayouts.vue)
================================================
FILE: website/docs/zh/guide/09-dynamic-add-remove.md
================================================
# 09 - 动态添加/删除
[查看资料](https://github.com/jbaysolutions/vue-grid-layout/blob/master/website/docs/.vuepress/components/Example09DynamicAddRemove.vue)
================================================
FILE: website/docs/zh/guide/10-drag-from-outside.md
================================================
# 10 - 从外面拖动
该演示演示了从栅格外部添加部件时发生的情况。
将部件放到栅格中后,您将获得其坐标/属性,并可以据此执行操作。
[查看资料](https://github.com/jbaysolutions/vue-grid-layout/blob/master/website/docs/.vuepress/components/Example10DragFromOutside.vue)
================================================
FILE: website/docs/zh/guide/11-bounded.md
================================================
# 11 - 拖动栅格元素绑定到容器
可以获得栅格元素的坐标与容器间的绑定关系。
[查看资料](https://github.com/jbaysolutions/vue-grid-layout/blob/master/website/docs/.vuepress/components/Example11Bounded.vue)
================================================
FILE: website/docs/zh/guide/README.md
================================================
# 安装
## NPM
npm install vue-grid-layout --save
## Yarn
yarn add vue-grid-layout
导入库
```javascript
import VueGridLayout from 'vue-grid-layout';
```
添加到其他Vue组件
```javascript
export default {
components: {
GridLayout: VueGridLayout.GridLayout,
GridItem: VueGridLayout.GridItem
},
// ... data, methods, mounted (), etc.
}
```
## 浏览器
包括可用于浏览器的软件包([从发布版本](https://github.com/jbaysolutions/vue-grid-layout/releases)下载)。组件将自动可用。
```html
```
================================================
FILE: website/docs/zh/guide/auto-size.md
================================================
# 自动调整栅格元素
待办: https://github.com/jbaysolutions/vue-grid-layout/issues/351
================================================
FILE: website/docs/zh/guide/events.md
================================================
# 事件
每一个栅格元素grid-item上都可以添加监听器,用于监听移动和调整大小事件,这样父级Vue对象就可以收到通知。
示例 [点击这里](../guide/02-events.md)
````html
{{item.i}}
````
## GridLayout
### layoutCreatedEvent
对应Vue生命周期的created
```javascript
layoutCreatedEvent: function(newLayout){
console.log("Created layout: ", newLayout)
}
```
### layoutBeforeMountEvent
对应Vue生命周期的beforeMount
```javascript
layoutBeforeMountEvent: function(newLayout){
console.log("beforeMount layout: ", newLayout)
}
```
### layoutMountedEvent
对应Vue生命周期的mounted
```javascript
layoutMountedEvent: function(newLayout){
console.log("Mounted layout: ", newLayout)
}
```
### layoutReadyEvent
当完成mount中的所有操作时生成的事件
```javascript
layoutReadyEvent: function(newLayout){
console.log("Ready layout: ", newLayout)
}
```
### layoutUpdatedEvent
布局updated事件
更新事件(布局更新或栅格元素的位置重新计算)
```javascript
layoutUpdatedEvent: function(newLayout){
console.log("Updated layout: ", newLayout)
}
```
### breakpointChangedEvent
断点更改事件
每次断点值由于窗口调整大小而改变
```javascript
/**
*
* @param newBreakpoint the breakpoint name
* @param newLayout the chosen layout for the breakpoint
*
*/
breakpointChangedEvent: function(newBreakpoint, newLayout){
console.log("BREAKPOINT CHANGED breakpoint=", newBreakpoint, ", layout: ", newLayout );
},
```
## GridItem
### moveEvent
移动时的事件
```javascript
moveEvent: function(i, newX, newY){
console.log("MOVE i=" + i + ", X=" + newX + ", Y=" + newY);
},
```
### resizeEvent
调整大小时的事件
```javascript
resizeEvent: function(i, newH, newW, newHPx, newWPx){
console.log("RESIZE i=" + i + ", H=" + newH + ", W=" + newW + ", H(px)=" + newHPx + ", W(px)=" + newWPx);
},
```
### movedEvent
移动后的事件
```javascript
movedEvent: function(i, newX, newY){
console.log("MOVED i=" + i + ", X=" + newX + ", Y=" + newY);
},
```
### resizedEvent
调整大小后的事件
```javascript
/**
*
* @param i the item id/index
* @param newH new height in grid rows
* @param newW new width in grid columns
* @param newHPx new height in pixels
* @param newWPx new width in pixels
*
*/
resizedEvent: function(i, newH, newW, newHPx, newWPx){
console.log("RESIZED i=" + i + ", H=" + newH + ", W=" + newW + ", H(px)=" + newHPx + ", W(px)=" + newWPx);
},
```
### containerResizedEvent
栅格元素/栅格容器更改大小的事件(浏览器窗口或其他)
```javascript
/**
*
* @param i the item id/index
* @param newH new height in grid rows
* @param newW new width in grid columns
* @param newHPx new height in pixels
* @param newWPx new width in pixels
*
*/
containerResizedEvent: function(i, newH, newW, newHPx, newWPx){
console.log("CONTAINER RESIZED i=" + i + ", H=" + newH + ", W=" + newW + ", H(px)=" + newHPx + ", W(px)=" + newWPx);
},
```
================================================
FILE: website/docs/zh/guide/examples.md
================================================
# 例子
## 基本
## 事件
## 多个网格
## 拖动允许/忽略元素
忽略对某些元素的拖动,而对其他元素允许。
单击并拖动每个栅格角上的点以重新定位
================================================
FILE: website/docs/zh/guide/properties.md
================================================
# 属性
## GridLayout
### layout
* type: `Array`
* required: `true`
这是栅格的初始布局。
数据源。值必须为 `Array`,其数据项为 `Object`。 每条数据项必须有 `i, x, y, w 和 h` 属性。 请参考下面的 `GridItem`。
### responsiveLayouts
* type: `Object`
* required: `false`
* default : `{}`
如果 `responsive` 设置为 `true`,该配置将作为栅格中每个断点的初始布局。键值是断点名称,每项的值都是类似 `layout` 属性定义的数据结构,值必须为 `Array`,其数据项为 `Object`。例如: `{lg: [layout items], md: [layout items]}`。需要注意的是,在创建栅格布局后设置该属性无效。
在创建GridLayout之后设置prop无效。
可以查看 [responsive](#responsive), [breakpoints](#breakpoints) 和 [cols](#cols)
### colNum
* type: `Number`
* required: `false`
* default: `12`
定义栅格系统的列数,其值需为自然数。
### rowHeight
* type: `Number`
* required: `false`
* default: `150`
每行的高度,单位像素。
### maxRows
* type: `Number`
* required: `false`
* default: `Infinity`
定义最大行数。
### margin
* type: `Array`
* required: `false`
* default: `[10, 10]`
定义栅格中的元素边距。
值必须是包含两个 `Number`的数组,数组中第一个元素表示水平边距,第二个表示垂直边距,单位为像素。
### isDraggable
* type: `Boolean`
* required: `false`
* default: `true`
标识栅格中的元素是否可拖拽。
### isResizable
* type: `Boolean`
* required: `false`
* default: `true`
标识栅格中的元素是否可调整大小。
### isMirrored
* type: `Boolean`
* required: `false`
* default: `false`
标识栅格中的元素是否可镜像反转。
### autoSize
* type: `Boolean`
* required: `false`
* default: `true`
标识容器是否自动调整大小。
### verticalCompact
* type: `Boolean`
* required: `false`
* default: `true`
标识布局是否垂直压缩。
### preventCollision
* type: `Boolean`
* required: `false`
* default: `false`
防止碰撞属性,值设置为`ture`时,栅格只能拖动至空白处。
### useCssTransforms
* type: `Boolean`
* required: `false`
* default: `true`
标识是否使用CSS属性 `transition-property: transform;`。
### responsive
* type: `Boolean`
* required: `false`
* default: `false`
标识布局是否为响应式。
可以查看 [responsiveLayouts](#responsivelayouts)、[breakpoints](#breakpoints)和 [cols](#cols)
### breakpoints
* type: `Object`
* required: `false`
* default: { lg: 1200, md: 996, sm: 768, xs: 480, xxs: 0 }
为响应式布局设置断点。
可以查看 [responsiveLayouts](#responsivelayouts) 和 [cols](#cols)
### cols
* type: `Object`
* required: `false`
* default: { lg: 12, md: 10, sm: 6, xs: 4, xxs: 2 }
设置每个断点对应的列数。
### useStyleCursor
* type: `Boolean`
* required: `false`
* default: `true`
标识是否使用动态鼠标指针样式。当拖动出现卡顿时,将此值设为 `false`也许可以缓解布局问题。
**此属性无效**
## GridItem
### i
* type: `String`
* required: `true`
栅格中元素的ID。
### x
* type: `Number`
* required: `true`
标识栅格元素位于第几列,需为自然数。
### y
* type: `Number`
* required: `true`
标识栅格元素位于第几行,需为自然数。
### w
* type: `Number`
* required: `true`
标识栅格元素的初始宽度,值为`colWidth`的倍数。
### h
* type: `Number`
* required: `true`
标识栅格元素的初始高度,值为`rowHeight`的倍数。
### minW
* type: `Number`
* required: `false`
* default: `1`
栅格元素的最小宽度,值为`colWidth`的倍数。
如果`w`小于`minW`,则`minW`的值会被`w`覆盖。
### minH
* type: `Number`
* required: `false`
* default: `1`
栅格元素的最小高度,值为`rowHeight`的倍数。
如果`h`小于`minH`,则`minH`的值会被h覆盖。
### maxW
* type: `Number`
* required: `false`
* default: `Infinity`
栅格元素的最大宽度,值为`colWidth`的倍数。
如果`w`大于`maxW`,则`maxW`的值会被`w`覆盖。
### maxH
* type: `Number`
* required: `false`
* default: `Infinity`
栅格元素的最大高度,值为`rowHeight`的倍数。
如果`h`大于`maxH`,则`maxH`的值会被`h`覆盖。
### isDraggable
* type: `Boolean`
* required: `false`
* default: `null`
标识栅格元素是否可拖拽。如果值为`null`则取决于父容器。
### isResizable
* type: `Boolean`
* required: `false`
* default: `null`
标识栅格元素是否可调整大小。如果值为`null`则取决于父容器。
### static
* type: `Boolean`
* required: `false`
* default: `false`
标识栅格元素是否为静态的(无法拖拽、调整大小或被其他元素移动)。
### dragIgnoreFrom
* type: `String`
* required: `false`
* default: `'a, button'`
标识栅格元素中哪些子元素无法触发拖拽事件,值为`css-like`选择器。
请参考[interact.js docs](http://interactjs.io/docs/#ignorable-selectors)中的`ignoreFrom`。
### dragAllowFrom
* type: `String`
* required: `false`
* default: `null`
标识栅格元素中哪些子元素可以触发拖拽事件,值为`css-like`选择器。
如果值为`null`则表示所有子元素(`dragIgnoreFrom`的除外)。
请参考[interact.js docs](http://interactjs.io/docs/#ignorable-selectors)中的`allowFrom`。
### resizeIgnoreFrom
* type: `String`
* required: `false`
* default: `'a, button'`
标识栅格元素中哪些子元素无法触发调整大小的事件,值为`css-like`选择器。
请参考[interact.js docs](http://interactjs.io/docs/#ignorable-selectors)中的`ignoreFrom`。
================================================
FILE: website/docs/zh/guide/styling.md
================================================
# 样式
可以定制栅格样式以适合您的需求。以下是可以覆盖的类的列表。
## 占位符
占位符的默认css为:
````css
.vue-grid-item.vue-grid-placeholder {
background: red;
opacity: 0.2;
transition-duration: 100ms;
z-index: 2;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-o-user-select: none;
user-select: none;
}
````
您可以使用`!important`规则覆盖属性:
````css
.vue-grid-item.vue-grid-placeholder {
background: green !important;
}
````
或者通过用更[具体的](https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity)方式包装栅格类:
````css
.container .vue-grid-item.vue-grid-placeholder {
background: green;
}
````
在此示例中,我们将占位符的背景色更改为绿色:
[查看资料](https://github.com/jbaysolutions/vue-grid-layout/blob/master/website/docs/.vuepress/components/ExampleStylingPlaceholder.vue)
工作正在进行中...
================================================
FILE: website/docs/zh/guide/usage.md
================================================
# 用法
```javascript
new Vue({
el: '#app',
data: {
layout: [
{"x":0,"y":0,"w":2,"h":2,"i":"0"},
{"x":2,"y":0,"w":2,"h":4,"i":"1"},
{"x":4,"y":0,"w":2,"h":5,"i":"2"},
{"x":6,"y":0,"w":2,"h":3,"i":"3"},
{"x":8,"y":0,"w":2,"h":3,"i":"4"},
{"x":10,"y":0,"w":2,"h":3,"i":"5"},
{"x":0,"y":5,"w":2,"h":5,"i":"6"},
{"x":2,"y":5,"w":2,"h":5,"i":"7"},
{"x":4,"y":5,"w":2,"h":5,"i":"8"},
{"x":6,"y":3,"w":2,"h":4,"i":"9"},
{"x":8,"y":4,"w":2,"h":4,"i":"10"},
{"x":10,"y":4,"w":2,"h":4,"i":"11"},
{"x":0,"y":10,"w":2,"h":5,"i":"12"},
{"x":2,"y":10,"w":2,"h":5,"i":"13"},
{"x":4,"y":8,"w":2,"h":4,"i":"14"},
{"x":6,"y":8,"w":2,"h":4,"i":"15"},
{"x":8,"y":10,"w":2,"h":5,"i":"16"},
{"x":10,"y":4,"w":2,"h":2,"i":"17"},
{"x":0,"y":9,"w":2,"h":3,"i":"18"},
{"x":2,"y":6,"w":2,"h":2,"i":"19"}
],
},
});
```
```html
{{item.i}}
```
================================================
FILE: website/package.json
================================================
{
"name": "vue-grid-layout-website",
"version": "1.0.0",
"description": "vue-grid-layout website",
"author": "Gustavo Santos (gustavo@jbaysolutions.com)",
"license": "MIT",
"private": false,
"scripts": {
"dev": "cross-env NODE_OPTIONS=--openssl-legacy-provider vuepress dev docs",
"build": "vuepress build docs",
"serve": "cross-env NODE_OPTIONS=--openssl-legacy-provider vuepress serve docs"
},
"dependencies": {
},
"devDependencies": {
"cross-env": "^7.0.3",
"@vuepress/plugin-back-to-top": "^1.9.9",
"@vuepress/plugin-google-analytics": "^1.9.9",
"vue-grid-layout": "^2.4.0",
"vuepress-plugin-seo": "^0.1.4",
"vuepress-plugin-sitemap": "^2.3.1",
"vuepress": "^1.9.9",
"vuepress-plugin-serve": "^2.0.4"
},
"resolutions": {
"watchpack": "1.6.1"
}
}