前端白名单过滤
作者:互联网
router.beforeEach(((to, from, next) => { let white = ['/clogin', '/index', '/'] if (white.includes(to.path)) { next() } else { let vuelist = localStorage.getItem('vuelist') console.log(vuelist) if (vuelist) { let reslist = JSON.parse(vuelist) console.log(reslist) let reslist1 = [] for (let i in reslist) { console.log(i) reslist1.push(reslist[i]["url"]) } console.log(reslist1) if (reslist1.includes(to.path)) { next() } else { alert('没有权限') return false; } } } }))
标签:reslist1,console,log,前端,vuelist,过滤,let,白名单,reslist 来源: https://www.cnblogs.com/ztlman/p/15977536.html