detail的路径正确,但是不跳转
来源:9-1 Vue项目详情页 - 动态路由和banner布局
慕码人5437048
2020-08-06
路径正确,但是不跳转,我更换了电脑,代码是git上下载下来重新安装了一下,不知道这个有没有影响,
点击后,url是http://localhost:8080/#/detail/0001,并且后台不报错,甚至没有反应
<router-link
tag="li"
class="item border-bottom"
v-for="item of list"
:key="item.id"
:to="'/detail/' + item.id"
>
<img class="item-img" :src="item.imgUrl"/>
<div class="item-info">
<p class="item-title">{{ item.title }}</p>
<p class="item-desc">{{ item.desc }}</p>
<button class="item-button">查看详情</button>
</div>
</router-link>import Vue from 'vue';
import Router from 'vue-router';
import Home from '@/pages/home/Home';
import City from '@/pages/city/City';
import Detail from '@/pages/detail/Detail';
Vue.use(Router);
export default new Router({
routes: [{
path: '/',
name: 'Home',
component: Home,
}, {
path: '/city',
name: 'City',
component: City,
}, {
path: '/detail/:id',
name: 'Detail',
Component: Detail,
}],
});<template>
<div>
detail
</div>
</template>
<script>
export default {
name: 'Detail',
};
</script>
<style lang="stylus" scoped>
</style>写回答
2回答
-
强刷重启也没用对吧
122020-08-08 -
呀呀呀亚歌
2020-08-06
转跳的内容会显示在router-view中
00
相似问题