1.1.1 • Published 7 years ago

vue-content-placeholder v1.1.1

Weekly downloads
91
License
-
Repository
-
Last release
7 years ago

vue-content-placeholder

travis-ci

Inspired by Facebook content placeholder deconstruction

Get stared

Here is DEMO.

npm.io

How does it work?

You can check out the article above. The difference is that I use the property of flex instead of absolute in every row.

The boxes can be custom height and custom width, you can choose a fixed height with px, or just use Number to declare its flex-basis or use %, em ...

How to use?

ES6

/* in xxx.vue */
<content-placeholder :rows="placeholderRows"></content-placeholder>

import ContentPlaceholder from 'vue-content-placeholder'

export default {
  ...
  data () {
    return {
      placeholderRows:  [
        {
          height: '25px',
          boxes: [[0, '100px']]
        },
        {
          height: '25px',
          boxes:[[0, '100px'], ['10%', 1]]
        },
        {
          height: '25px',
          boxes: [[0, '100px']]
        },
        {
          height: '25px',
          boxes:[[0, '100px'], ['10%', 2]]
        },
        { height: '2rem',
          boxes: [[0, 0]]
        },
        { height: '1rem',
          boxes: [[0, 5]]
        },
        { height: '1rem',
          boxes: [[0, 0]]
        },
        { height: '1rem',
          boxes: [[0, '50%']]
        },
        { height: '1rem',
          boxes: [[0, 0]]
        },
        { height: '1rem',
          boxes: [[0, '10em']]
        }
      ]
    }
  },
  components: {
    ContentPlaceholder
  },
  ...
}

Option

Optionstypediscription
rowsArrayThe property of the component
rowObjectThe element of the rows
row.heightStringThe height of the row, support px, rem, em, %
row.boxesArrayThe transition boxes of the row
boxArrayThe box in the row.boxes
box0String or NumberTo declare the width of the left gutter
box1String or NumberTo declare the width of the box
sizeStringControl the animation, such as 250% or 900px

Contribution

  • Fork it
  • PR
1.1.1

7 years ago

1.1.0

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago