Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
shen-lan opened this issue Aug 31, 2018 · 1 comment
Open

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

shen-lan opened this issue Aug 31, 2018 · 1 comment

Comments

@shen-lan
Copy link

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后进度条消失。
正常应该是有一个进度的过程的吧?

@chiaweilee
Copy link
Contributor

try remove this:

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants