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.rolfjoneslaw.com:临潭县| www.shermantheband.com:林周县| www.spike123.com:宁远县| www.enshuohuojia.com:甘泉县| www.soft-file.org:吉首市| www.shopzall.com:舒城县| www.rareearthsoil.com:香河县| www.ladyrss.com:江达县| www.the-kish.com:建湖县| www.505love.com:喜德县| www.lysyjj.com:灵武市| www.zjmetong.com:乐平市| www.abouthorses.net:河池市| www.jmin00.com:娱乐| www.wyadorkable.com:灵石县| www.brushhairandmakeup.com:芦山县| www.apics-hawaii.org:江孜县| www.zngnw.cn:曲水县| www.royaltyaffairs.com:聂拉木县| www.zearchsd.com:普洱| www.sidewaysmilk.com:营口市| www.urethritis.org:宁晋县| www.k6558.com:关岭| www.magnetiseur-toulon.com:湾仔区| www.chevroletbandung.com:湟中县| www.927945.com:沂源县| www.ccshcy.com:九龙城区| www.qqyyzs.com:启东市| www.wapgdp.com:四川省| www.bestkitchenkniveslist.com:桓台县| www.hg85456.com:柞水县| www.sutibao.com:绥棱县| www.homakimiblog.com:古丈县| www.srmcinc.org:惠水县| www.bd9777.com:镇安县| www.jsxysp.com:迭部县| www.hdneyo.com:饶阳县| www.qj-metallicyarn.com:四川省| www.supermoveme.com:湄潭县| www.carandpetspa.com:罗江县| www.peregrinereads.org:共和县| www.kyriakosandkolette.com:金秀| www.g9867.com:申扎县| www.zn677.com:海林市| www.pb559.com:客服| www.z9698.com:广州市| www.0527tm.com:松原市| www.qz553.com:南部县| www.swwwy.com:万荣县| www.galynka.com:当雄县| www.jjmatransportation.com:新建县| www.cecilevangrieken.com:精河县| www.pornofilmid.net:德化县| www.summonerscentral.com:玛沁县| www.cctvecoplus.com:怀仁县| www.amzabawki.com:屯留县| www.redmarked.com:大城县| www.hust-hy.com:河东区| www.mz733.com:宁安市| www.mosmedia.net:呼和浩特市| www.bestjav4you.com:无为县| www.egocol.com:积石山| www.spielgeil.com:志丹县| www.ccgyzh.com:龙陵县| www.dressupchic.com:茶陵县| www.uclubct.com:东平县| www.zzliyu.com:铁力市| www.hlswclub.com:黔南| www.arecipesite.com:巴南区| www.dl235.com:元朗区| www.muchasautorepair.com:夏河县| www.pixiankong.com:靖江市| www.ynthp.com:河源市| www.nicolasbessol.com:辽宁省| www.beardiac.com:漳州市| www.hooterspanama.com:花莲县| www.trackallpackages.net:湖口县| www.kpt555.com:瑞安市| www.aashbooksplus.com:甘谷县| www.aaagascalculator.com:出国| www.4fsy.com:宜兰县| www.pengten518.com:盐亭县| www.huasupu.cn:潮州市| www.dadouyoushebei.com:鹿邑县|