目标:浏览器输入http://localhost/#/tool/quota,展示以下界面并实现功能(以实现查询额度功能为例,接口类型get)
前端代码:
#vue代码 index.js
import Vue from 'vue'
import Router from 'vue-router'
import elaside from '@/components/Elaside'
#测试页面路由
import QuotaTest from '@/components/main/product_testing/efficiency_tools/QuotaTest'
Vue.use(Router)
const router = new Router({
routes: [
{
path: '/',
component: elaside,
meta: {
title: '测试平台' },
children: [
{
path: '/tool/quota', //这就是浏览器里输入的url
meta: {
title: '操作额度' },
component: QuotaTest
} ]
}
]
})
router.beforeEach((to, from, next) => {
if (to.meta.title) {
document.title = to.meta.title
} else {
document.title = '测试平台'
}
next()
})
export default router
#vue代码,界面QuotaTe