34

GitHub - meloalright/vue-ins-progress-bar: 一款 ins 风格的 vue 进度条组件

 7 years ago
source link: https://github.com/meloalright/vue-ins-progress-bar
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

README.md

slogan

vue-ins-progress-bar

a vue component of ins-style progress bar

一款 ins 风格的 vue 进度条组件

Demo

Live Demo

Install

npm i vue-ins-progress-bar   

Usage

main.js

import VueInsProgressBar from 'vue-ins-progress-bar'

const options = {
  position: 'fixed',
  show: true,
  height: '3px'
}

Vue.use(VueInsProgressBar, options)

App.vue

<template>
  <div id="app">
    <router-view/>
    <vue-ins-progress-bar></vue-ins-progress-bar>
  </div>
</template>

<script>
export default {
  name: 'App',
  mounted () {
    this.$insProgress.finish()
  },
  created () {
    this.$insProgress.start()

    this.$router.beforeEach((to, from, next) => {
      this.$insProgress.start()
      next()
    })

    this.$router.afterEach((to, from) => {
      this.$insProgress.finish()
    })
  }
}
</script>

APIs

this.$insProgress.start() // start the loading
this.$insProgress.finish() // finish the loading
this.$insProgress.height(4) // resize the height of loading bar to 4px

Source

Repository: vue-ins-progress-bar      

Author: @meloalright

License

MIT


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK