动态路由

master
ewall 7 years ago
parent 8b4b776c13
commit a8aad57bc1

@ -1,13 +1,13 @@
import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/components/HelloWorld'
import Goods from '@/view/goods'
import Test from '@/view/test'
Vue.use(Router)
export default new Router({
routes: [{
path: '/test',
path: '/test/:testId',
name: 'test',
component: Test,
}]

@ -1,13 +0,0 @@
<template>
<div class="goods">
This is goods
<span>{{$route.query.goodsId}}</span>
</div>
</template>
<script>
export default {
}
</script>
<style scoped></style>

@ -0,0 +1,17 @@
<template>
<div class="test">
This is id: {{$route.params.testId}}
</div>
</template>
<script>
export default {
data() {
return {
msg: 'hello vue'
}
}
}
</script>
<style scoped></style>
Loading…
Cancel
Save