vue路由导航守卫,赋值data

	beforeRouteEnter (to, from, next) {
		next( vm => {

			if(to.path == "/expense-account/accountant-details"){
				vm.audit = 1
			}

			if(to.path == "/expense-account/fund-details"){
				vm.audit = 2
			}
		})
	},
let sign = 0
*******************
beforeRouteUpdate (to, from, next) {
		if(to.path == "/expense-account/accountant-details"){
			sign = 1
		}

		if(to.path == "/expense-account/fund-details"){
			sign = 2
		}
		next()
	},
	created () {
		this.audit = sign
	}

你可能感兴趣的:(vue)