23 |
24 |
25 |
26 | {{ item.someContent }}
27 |
28 |
29 |
30 |
31 |
32 |
39 |
40 | ```
41 |
42 | ### With animation
43 |
44 | For animation, simply add `style="transition: transform 300ms"` to the `stack-item`s.
45 |
46 | ### With images
47 |
48 | If images appear anywhere in the stack items, apply the `monitor-images-loaded` prop to the `stack` component.
49 |
50 | ## Props
51 |
52 | ### Stack
53 |
54 | | Name | Type | Required | Default | Description |
55 | | --- | --- | --- | --- | --- |
56 | | `column-min-width` | Number | Yes | | The minimum width of columns. If the columns do not fit into the container anymore, the number of columns is reduced. |
57 | | `gutter-width` | Number | No | `0` | The space between columns in pixels. |
58 | | `gutter-height` | Number | No | `0` | The space between items in the same column. |
59 | | `monitor-images-loaded` | Boolean | No | `false` | If true, reflow once all images are loaded using [vue-images-loaded](https://github.com/David-Desmaisons/Vue.ImagesLoaded). This is recommended if any of the stack items contain images, as the images might not be loaded yet when the initial positions and sizes are computed. |
60 |
61 | Note that `gutter-width` and `gutter-height` can also be replaced by adding margin/padding to the stack items.
62 |
63 | ## Examples
64 | Clone the repository and run: `npm run examples`
65 |
66 | ## Future plans
67 |
68 | - Handle adding/removing items.
69 | - Add build system.
70 | - Add demo.
71 | - **Please make feature requests if you have any!**
72 |
--------------------------------------------------------------------------------
/bin/examples.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | const { lstatSync, readdirSync } = require('fs')
4 | const { join, resolve } = require('path')
5 | const { execSync } = require('child_process')
6 | const inquirer = require('inquirer')
7 |
8 | const EX_DIR = resolve('examples')
9 | const IS_WIN = /^win/.test(process.platform)
10 |
11 | const dirs = readdirSync(EX_DIR).map(fn => join(EX_DIR, fn)).filter(f => (
12 | lstatSync(f).isDirectory()
13 | ))
14 |
15 | inquirer.prompt([{
16 | type: 'list',
17 | name: 'ex',
18 | message: 'Which example would you like to run?',
19 | choices: dirs.map(dir => dir.replace(`${EX_DIR}/`, ''))
20 | }])
21 | .then(r => {execSync(IS_WIN ? `poi ${r.ex}` : `poi ${join(EX_DIR, r.ex)}`, { stdio: [0, 1, 2] }) })
22 | // swallow child exit exceptions
23 | .catch(() => process.exit(0))
24 |
--------------------------------------------------------------------------------
/examples/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WouterFlorijn/vue-stack-grid/ec17f08347bfd61dcc504832293de23f9593687d/examples/.gitkeep
--------------------------------------------------------------------------------
/examples/simple/App.vue:
--------------------------------------------------------------------------------
1 |