Giter Club home page Giter Club logo

vue-skeleton's Introduction

vue-skeleton

基于Vue的骨架屏实现

使用方法

  import Skeleton from './index.js'
  Vue.component(Skeleton.name, Skeleton)
  <template>
    <gm-skeleton>
      <Component />
      <div></div>
      <p><span></span></p>
    </gm-skeleton>
  </template>
  .gm-skeleton {
    background-image: linear-gradient(90deg,#f2f2f2 25%,#e6e6e6 37%,#f2f2f2 63%) !important;
    background-color: transparent !important;
    background-size: 400% 100%;
    animation: skeleton-loading 1.5s ease-in infinite;
    min-height: .3rem;
    min-width: 1rem;
  }
  
  @keyframes skeleton-loading {
    from {
      background-position: 100% 50%;
    }
    to {
      background-position: 0 50%;
    }
  }

Props

属性名 描述
showSpin Boolean 判断是否显示骨架屏(默认为true)
skeletPrefix String 骨架屏ClassName(默认为gm-skeleton)
init Boolean 默认第一层的子元素不添加骨架屏名字,因为背景色一般都会设置在根元素上,所以这里不做骨架屏处理,默认为true

完整分析

思路原理分析

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.