vue 2.8.2版本配置剛進入時候的默認頁面方法
更新時間:2018年09月21日 08:46:25 作者:ylhsuper
今天小編就為大家分享一篇vue 2.8.2版本配置剛進入時候的默認頁面方法,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
vue --version查看版本 是 2.8.2;
vue 2.8.2版本配置剛進入時候的默認頁面比如這里面的goods頁面;
1.在路由文件下里面的index.js文件 添加 { path: '/', redirect: '/goods/goods' }, // 默認就跳轉(zhuǎn)此頁面
2.也可以在app.vue里面配置
this.$router.push('/goods/goods'); // 頁面加載時跳轉(zhuǎn)
詳情看下面
export default {
name: 'app',
components: {
'v-header': header
},
created () {
// this.$router.push('/goods/goods'); // 頁面加載時跳轉(zhuǎn)
}
};
前提都配置了此組件路由index.js文件如下
import Vue from 'vue';
import Router from 'vue-router';
import goods from '../components/goods/goods';
import ratings from '../components/ratings/ratings';
import seller from '../components/seller/seller';
Vue.use(Router);
export default new Router({
routes: [
{ path: '/', redirect: '/goods/goods' }, // 默認就跳轉(zhuǎn)此頁面
{
path: '/goods/goods',
name: 'goods',
component: goods
},
{
path: '/ratings/ratings',
name: 'ratings',
component: ratings
},
{
path: '/seller/seller',
name: 'seller',
component: seller
}
]
});
以上這篇vue 2.8.2版本配置剛進入時候的默認頁面方法就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持腳本之家。
相關(guān)文章
Vue手把手教你擼一個 beforeEnter 鉤子函數(shù)
這篇文章主要介紹了Vue手把手教你擼一個 beforeEnter 鉤子函數(shù),小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2018-04-04
使用vue-infinite-scroll實現(xiàn)無限滾動效果
vue-infinite-scroll插件可以無限滾動實現(xiàn)加載更多,其作用是是當滾動條滾動到距離底部的指定高度時觸發(fā)某個方法。這篇文章主要介紹了用vue-infinite-scroll實現(xiàn)無限滾動效果,需要的朋友可以參考下2018-06-06

