vue-progressbar icon indicating copy to clipboard operation
vue-progressbar copied to clipboard

为什么我 直接从一开始就是100%的进度?

Open shen-lan opened this issue 6 years ago • 1 comments

1.main.js

import VueProgressBar from 'vue-progressbar';
Vue.use(VueProgressBar, {
    color: 'rgb(64,158,255)',
    failedColor: 'red',
    height: '2px',
    transition: {
        speed: '0.2s',
        opacity: '0.6s',
        termination: 300
    }
});

router.beforeEach((to, from, next) => {
	if (to.meta.requireAuth) {
		if (sessionStorage.getItem('adminManage')) {
            next();
		} else {
			next({
				path: '/'
			});
		}
	} else {
        next();
        if (to.path === '/') {
            sessionStorage.removeItem('adminManage');
        } //登录页清除登录信息
    }
    document.title = to.meta.title;
});

2.app.vue

export default {
    name: 'App',
    created() {
        this.$Progress.start();
        this.$router.beforeEach((to, from, next) => {
            this.$Progress.start();
            next();
        });

        this.$router.afterEach((to, from) => {
            this.$Progress.finish();
        });
    },
    mounted() {
        this.$Progress.finish();
    }
};

3.问题 从start就是100%的进度,finsh后进度条消失。 正常应该是有一个进度的过程的吧?

shen-lan avatar Aug 31 '18 02:08 shen-lan

try remove this:

mounted() {this.$Progress.finish();}

chiaweilee avatar Nov 09 '18 09:11 chiaweilee