vue搭建项目步骤,vue开发web网站
这是vue create文件名出现的文件,其最外层位于此app.js
此部分为下图中的home|about,如果存在此部分,则整个vue分为标题和以下内容页面。如果删除此部分,则整个页面将合并为一个页面。
路由器-视图是路由跳转到页面。
查看router文件夹下的index.js文件
这里规定了跳转目标和配置路径
说明http://192.168.1.27:8080/端口号后接“/”,则跳至主页
这里规定了与Home对应的文件
路由保护代码
router.beforeeach(function(to,from, next ) (if ) to.meta.needlogin ) /页面上是否注册了if ) localstorage.getitem ) ) { console.log (token ) /存在可以将路由对象作为指示跳转到的页面next { name : '/log in ' } else { console.log } '未被路由的参数传递