1. 設為首頁   文化中國網歡迎您~!

          Vue中路由導航 && 重定向 && 默認樣式

          路由定義:

          把數據從一個地方傳送到另一個地方的行為和動作。

          1.在main.js文件中引入路由,如果router文件夾中,不是index.js文件,需在此處寫上指定文件(如是abc.js), import router from './router/abc.js'


          2.定義了一個navView.vue文件,在App.vue引入該組件,

          App.vue文件:
          <navView></navView>
          import navView from './components/navView'
          components:{
          // banner
          navView
          },

          3.在navView文件中插入路由,(前提是有banner tab 這倆組件)

          <router-link to="/banner">輪播</router-link>
          <router-link to="/tab">切換</router-link>

          4.在router/index.js文件中引入路徑,并配置

          import banner from '../components/banner'
          import tab from '../components/tab'
          {
          path: '/banner',
          name: 'banner',
          component: banner
          },
          {
          path: '/tab',
          name: 'tab',
          component: tab、

          },

          5.路由的出口,路由匹配到的組件渲染的位置,在App.vue中加入,到此處簡單路由就完事了

          <router-view></router-view>





          如果想給個默認的樣式:

          1.router/index.js文件的中,加入:
          linkActiveClass:'active', //名字可以隨意定義

          2.在navView.vue加入此樣式,字體顏色就是pink
          .active{ color:pink}



          如果想重定向一打開域名的鏈接

           redirect:'/banner' //重定向


          推薦閱讀:神馬域名出售
          好运来 www.51pag.com:丰原市| www.shhupai.com:三穗县| www.tendainfo.com:南昌县| www.paletteblog.com:万山特区| www.baina-edu.com:新竹县| www.zipcodeme.com:凤翔县| www.flying-nerd.com:镇康县| www.gzzhaojiabg.com:宁强县| www.dashrescue.org:石泉县| www.jnsqzn.com:太康县| www.zdrowienatalerzu.com:右玉县| www.ezkertza.com:防城港市| www.ridgwaytowing.com:汾西县| www.sclxss.com:明水县| www.teknikellermakina.com:榕江县| www.websaran.com:石林| www.keybiz.org:横山县| www.mu788.com:雷山县| www.auburnoysterbar.com:苍南县| www.chen0370.com:巴东县| www.aryavartcollege.com:岚皋县| www.reewallpapers.com:伊吾县| www.zslicaixd.com:洛扎县| www.foothill-bible.org:阳原县| www.hg59789.com:环江| www.blueflagfarm.com:称多县| www.friendsofryankennedy.com:隆化县| www.jiandingqinzi.com:高邑县| www.bar-dendo.com:基隆市| www.chevroletbandung.com:辉县市| www.lzhso.com:班玛县| www.fzv0.com:余江县| www.gvionlinetraining.com:朝阳县| www.farukfunclub.com:荥阳市| www.eugeniopetulla.com:石河子市| www.01qiuxiady.com:余姚市| www.kctkp.cn:许昌县| www.yaonvguan.com:资兴市| www.xmsmly.com:伊川县| www.photolockr.com:社旗县| www.musicrepgroup.com:石狮市| www.bgesystems.com:五寨县| www.vcmarienkirchen.com:丹东市| www.chambres-dhotes-le-cigalon.com:方城县| www.nokian97blog.com:克山县| www.hg43678.com:静海县| www.slgjys.com:乌什县| www.274252.com:田阳县| www.yngmj.com:依安县| www.feeling2007.com:陇川县| www.louisgh.com:梁平县| www.jinjin2car.com:保康县| www.rctrw.cn:琼海市| www.dayurexian.com:阿巴嘎旗| www.nbphq.cn:文昌市| www.boyamax.com:亚东县| www.gw066.com:林甸县| www.q5653.com:宿松县| www.copperkidsolo.com:长垣县| www.frommybedtoyours.com:甘肃省| www.hoian-tailors.com:铜陵市| www.favepet.com:左权县| www.92dingyue.com:乳源| www.bccc14.com:武威市| www.glxinmei.com:凤冈县| www.club-editeur-web.com:大化| www.vicomech.com:北碚区| www.androidanalyze.com:曲靖市| www.trackallpackages.net:达日县| www.aujardindesgraines.com:祁连县| www.novowoodworks.com:邵东县| www.dellbjb.com:禄劝| www.zjubbs.net:登封市| www.ozcanis.com:清涧县| www.hg0088ag.com:广德县| www.prfacadier.com:郁南县| www.thisissohot.com:东丽区| www.rr36365.com:厦门市| www.foxbreaks.com:阿坝县| www.radiolauniversal.com:井陉县| www.z8689.com:屏东市| www.buyijiang.com:宽甸| www.changlonggy.com:永川市| www.nazliyarim.com:济阳县|