您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

vue.js如何配置路由

2024/3/29 19:08:24发布16次查看
vue.js配置路由的方法:1、安装vue-router;2、引用vue-router;3、配置路由文件,如【var router = new vuerouter({routes:[{path:/hello,component...】。
本文操作环境:windows10系统、vue.js 2.9、thinkpad t480电脑。
vue.js配置路由的方法步骤如下所示:
安装
npm install --save vue-router
引用
import vuerouter from 'vue-router'
配置路由文件
var router = new vuerouter({ routes:[ { path:"/hello", component:helloworld }, { path:"/wen", component:hellowen } ] }) new vue({ el: '#app', components: { app }, router, template: '<app/>' })
视图加载的位置
默认app.vue文件中加<router-view></router-view>
跳转导航
<router-link to="/hello">helloword</router-link>(渲染出来的是a标签)
推荐学习:php培训
以上就是vue.js如何配置路由的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product