首页 > 编程知识 正文

vue适合做管理系统吗,vue组件传值的五种方法

时间:2023-05-06 19:02:22 阅读:41821 作者:4439

1.router/index.js

importvuefrom ' vue ' importvuerouterfrom ' vue-router ' importloginfrom ' ./components/log in.vue ' importhomefrom ' . importhomefrom ' home ' vue.use (vue router ) const routes=[ { path: '/',redirece ] commin ' component 3360 home } (const router=newvue router ({ routes } ) router.beforeeach ) (to,from, next ) )/to访问的路径from版本////next (版本next )/login ) )强制跳转if ) to.path===login ) ) return next ) ) consttokenstr=window.sesionstorrater )的tokenstr(returnnext ) (/login ) ) next ) }导出

模板ivel-buttontype=' info ' @ click=' logout '退出/El-button/div/templatescriptexportdefault { methods 3360 tokenthis.$router.push ) )/login ) /返回登录页面}}/scriptstylelang='lession ' ) }

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。