All Projects → jrainlau → Vue Occupy

jrainlau / Vue Occupy

Licence: mit
A Vue directive for occupying content places before the data has been loaded.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Vue Occupy

Vue Awesome Mui
🏆Mui component for Vue.js(1.x ~ 2.x)
Stars: ✭ 307 (+41.47%)
Mutual labels:  vue-directive
V Img Fallback
Vue Image Fallback
Stars: ✭ 43 (-80.18%)
Mutual labels:  vue-directive
Vue Prlx
🔮 Vue.js parallax directive you were looking for (can animate translate & background-position)
Stars: ✭ 140 (-35.48%)
Mutual labels:  vue-directive
Vue.resize
Vue directive to detect resize events with deboucing and throttling capacity.
Stars: ✭ 318 (+46.54%)
Mutual labels:  vue-directive
Vue Esc
🏃 Vue.js directive to add a document event listener on escape keyup.
Stars: ✭ 33 (-84.79%)
Mutual labels:  vue-directive
Vue Responsive
A plugin for responsive handling with vue.js
Stars: ✭ 86 (-60.37%)
Mutual labels:  vue-directive
Vue Ripple Directive
Material Ripple Effect as Vue Directive.
Stars: ✭ 266 (+22.58%)
Mutual labels:  vue-directive
Vue Sticky
Stars: ✭ 161 (-25.81%)
Mutual labels:  vue-directive
Navscroll Js
Lightweight package for highlighting menu items as you scroll the page, also scrolling to target section when item clicked. Use as a vue component/directive or in vanilla js.
Stars: ✭ 41 (-81.11%)
Mutual labels:  vue-directive
Vue Scroll Reveal
A Vue directive to wrap @jlmake's excellent ScrollReveal library.
Stars: ✭ 138 (-36.41%)
Mutual labels:  vue-directive
Vuebar
(🗃️ Archived) Vue 2 directive for custom scrollbar that uses native scroll behavior. Lightweight, performant, customizable and without dependencies. Used successfully in production on https://ggather.com
Stars: ✭ 650 (+199.54%)
Mutual labels:  vue-directive
Vue Quill Editor
🍡@quilljs editor component for @vuejs
Stars: ✭ 6,874 (+3067.74%)
Mutual labels:  vue-directive
Vue Inputmask
Vue.js directive to add inputmask library to your inputs (vanilla javascript).
Stars: ✭ 110 (-49.31%)
Mutual labels:  vue-directive
Vue Easy Slider
Slider Component of Vue.js.
Stars: ✭ 313 (+44.24%)
Mutual labels:  vue-directive
Vue Awesome Swiper
🏆 Swiper component for @vuejs
Stars: ✭ 12,072 (+5463.13%)
Mutual labels:  vue-directive
Draggable Vue Directive
Vue2 directive that handles drag & drop
Stars: ✭ 286 (+31.8%)
Mutual labels:  vue-directive
V Animate Css
The easiest to implement Vue directive for Animate.css
Stars: ✭ 59 (-72.81%)
Mutual labels:  vue-directive
V Blur
⬜️ Vue directive to blur an element dynamically
Stars: ✭ 173 (-20.28%)
Mutual labels:  vue-directive
Vue Codemirror
⌨️ @codemirror component for @vuejs
Stars: ✭ 2,115 (+874.65%)
Mutual labels:  vue-directive
V Directives
vue自定义指令集合
Stars: ✭ 109 (-49.77%)
Mutual labels:  vue-directive

Vue-Occupy

A Vue directive for occupying content places before the data has been loaded.

It's good for user experiment improving.

Install

Using yarn or npm to install vue-occupy:

# yarn
yarn add vue-occupy

# npm
npm install vue-occupy

Usage

In your main.js file:

import VueOccupy from 'vue-occupy'

Vue.use(VueOccupy)

Now vue-occupy is a global Vue directive, you can use v-occupy in every .vue file.

Params

param type description necessary
data {Object} the data you bind to the node Yes
config {Object} the color lump's css config No

For example:

<template>
  <div id="app" style="width:200px;height:50px;">
    <div v-occupy="{ data: content, config }"></div>
  </div>
</template>

<script>
export default {
  data () {
    return {
      content: '',
      config: {
        width: '200px',
        height: '18px',
        background: '#ddd'
      }
    }
  },
  mounted () {
    fetch(url).then((result) => {
      this.content = result
    })
  }
}
</script>

Before the fetch method has requested the result data, the div with v-occupy="{ data: content, config }" would be occupying by a rectangle color lump. Once the data was loaded, the attribute content would be updated and be rendered into the html.

Note: the default configuration of vue-occupy looks like below:

{
  width: 100%; 
  height: 100%; 
  background: #eee
}

And the note with v-occupy will be like this:

<div v-occupy="{ data: content, config }">
  <div style="width: 100%; height: 100%; background: #eee;></div>
</div>

Which means your must set the exactly width and height attribute in the note with v-occupy, or overwrite the default configuration by binding config attribute. What's more, attributes like marginTop or paddingRight are illegal, you should write in 'margin-top': '10px' or 'padding-right': '10px' instead.

Lisence

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].