第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

可以在vue.js文件中修改router.js文件嗎?

可以在vue.js文件中修改router.js文件嗎?

繁華開滿天機 2018-10-18 19:15:21
可以在vue.js文件中修改router.js文件嗎
查看完整描述

1 回答

?
Smart貓小萌

TA貢獻1911條經(jīng)驗 獲得超7個贊

vue中vue-router的使用: main.js如何配置(es6的寫法):在引用之前記得先 npm 下所需要的vue import Vue from 'vue' import App from './App.vue' import Router from 'vue-router' import Resource from 'vue-resource' //import VueTouch from 'vue-touch' var VueTouch = require('vue-touch') //引入home頁面 import homepage from './page/home.vue' //引入test頁面 import test from './page/test.vue' Vue.use(Router); Vue.use(Resource); Vue.use(VueTouch); var router = new Router({ abstract: true, hashbang: false }); //實現(xiàn)頁面跳轉(zhuǎn) router.map({ '/home':{ component:homepage }, '/test':{ component:test }, }) router.start(App, '#app') // router.go('test'); 默認直接跳轉(zhuǎn)到 test 頁面 index.html中引入app.vue和build.js <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>vue.js學習筆記(2)</title> <link rel="stylesheet" type="text/css" href="style/bootstrap.css"> </head> <body> <!--此處注意加載順序,需要先加載dom在加載js,否則會'Cannot find element: #app'--> <div id='app'></div> <script src="static/build.js"></script> </body> </html> <style> body { } </style> app.vue引入router <template> <div class='all-container'> <div class="public-content">我是公共頁面</div> <div class='menu'> <ul class="list"> <li><a v-link='"/home"'>home頁面</a></li> <li><a v-link='"/test"'>test頁面</a></li> </ul> </div> <router-view transition='animation' class='container' keep-alive></router-view> </div> </template> home.vue <template> <div class="home"> <div class="htmleaf-content"> 我是home頁面的內(nèi)容 </div> </div> </template> test.vue <template> <div class="test"> <div class="test-content"> 我是test頁面的內(nèi)容 </div> </div> </template> 最后用webpack 將程序打包.關(guān)于webpack大家可以看看 Vue.js——60分鐘webpack項目模板快速入門 webpack主頁 以上就是本文的全部內(nèi)容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。



查看完整回答
反對 回復(fù) 2018-11-18
  • 1 回答
  • 0 關(guān)注
  • 1707 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號