中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當(dāng)前位置: 首頁 > news >正文

推薦算法 網(wǎng)站開發(fā) java/制作網(wǎng)頁用什么軟件

推薦算法 網(wǎng)站開發(fā) java,制作網(wǎng)頁用什么軟件,柳州正規(guī)網(wǎng)站制作公司,互聯(lián)網(wǎng)推廣銷售是做什么的上篇我們講了vue路由的使用 今天我們來講vue中路由的嵌套,路由的params參數(shù),命名路由 一.路由的params參數(shù) 1.配置路由規(guī)則,使用children配置項(xiàng): router:[{path:/about,component:About,},{path:component:Home,//通過children配置子路由c…

上篇我們講了vue路由的使用

今天我們來講vue中路由的嵌套,路由的params參數(shù),命名路由

一.路由的params參數(shù)

1.配置路由規(guī)則,使用children配置項(xiàng):
router:[{path:'/about',component:About,},{path:component:Home,//通過children配置子路由chilren:{path:'news',//此處一定不要寫:/newcomponent:News},{path:'message',//此處一定不要寫:/messagecomponent:Message}}
]
2.跳轉(zhuǎn)(要寫完整路徑)
<router-link to="home/news">News<router-link>
//router中的index.js
//該文件專門用于創(chuàng)建整個(gè)應(yīng)用的路由器
import VueRouter  from "vue-router"import homeRouter from '../page/homeRouter'
import AboutRouter from '../page/aboutRouter'
import News from '../page/NewsRouter'
import Message from '../page/MessageRouter'// 創(chuàng)建并暴露一個(gè)路由器
export default new VueRouter({routes: [{path:'/about',component:AboutRouter},{path:'/home',// 二級(jí)路由component:homeRouter,children:[{path:'news',component:News,},{path:'message',component:Message,}]}]
})
//homeRouter.vue
<template><div><h3>我是home的內(nèi)容</h3><div><ul class="nav-tabs"><li><router-link to="/home/news">News</router-link></li><li><router-link to="/home/message">Message</router-link></li></ul><router-view></router-view></div></div>
</template><script>
export default {name:'homeRouter'
}
</script><style></style>
//homeRouter.vue
<template><div><h3>我是home的內(nèi)容</h3><div><ul class="nav-tabs"><li><router-link to="/home/news">News</router-link></li><li><router-link to="/home/message">Message</router-link></li></ul><router-view></router-view></div></div>
</template><script>
export default {name:'homeRouter'
}
</script><style></style>
//MessageRouter.vue
<template><div><ul><li><a href="">message001</a> </li><li><a href="">message002</a> </li><li><a href="">message003</a> </li></ul></div>
</template><script>
export default {name:'MessageRouter'
}
</script><style></style>
//newRouter.vue
<template><div><ul><li><a href="">New001</a></li><li><a href="">New002</a></li><li><a href="">New003</a></li></ul></div>
</template><script>
export default {}
</script><style>
</style>

如圖所示這就是展示的效果 :

?二.路由的query參數(shù)

1.傳遞參數(shù)
跳轉(zhuǎn)并攜帶query參數(shù),to的字符串寫法
<router-link :to="`/home/message/detail?id={m.id}&title={m.title}`"></router-link>
2.接收d參數(shù)
<router-link :to="{path:'/home/message/detail',query:{id:666,title:"你好"}}"></router-link>
//router的index.js
//該文件專門用于創(chuàng)建整個(gè)應(yīng)用的路由器
import VueRouter  from "vue-router"import homeRouter from '../page/homeRouter'
import AboutRouter from '../page/aboutRouter'
import News from '../page/NewsRouter'
import Message from '../page/MessageRouter'
import DetailRouter from '../page/DetailRouter';// 創(chuàng)建并暴露一個(gè)路由器
export default new VueRouter({routes: [{path:'/about',component:AboutRouter},{path:'/home',// 二級(jí)路由component:homeRouter,children:[{path:'news',component:News,},{path:'message',component:Message,children:[{path:'detail',component:DetailRouter}]}]}]
})
//messageRouter.vue
<template><div><ul><!-- 跳轉(zhuǎn)路由器并攜帶query參數(shù),to的字符串寫法 --><li v-for="m in messageList" :key="m.id"><!-- <router-link :to="`/home/message/detail?id=${m.id}&title=${m.title}`">{{m.title}}</router-link> --><!-- 跳轉(zhuǎn)路由并攜帶query參數(shù),to的對(duì)象寫法 --><router-link :to="{path:'/home/message/detail',query:{id:m.id,title:m.title}}">{{m.title}}</router-link></li></ul><hr><router-view></router-view></div>
</template><script>
export default {name:'MessageRouter',data() {return {messageList:[{id:'001',title:'消息001'},{id:'002',title:'消息002'},{id:'003',title:'消息003'}]}},}
</script><style>
</style>
//detail.vue
<template><ul><li>消息編號(hào):{{$route.query.id}}</li><li>消息標(biāo)題:{{$route.query.title}}</li></ul>
</template><script>
export default {name:'DetailRouter',
}
</script><style>
</style>

如圖:

?三.路由的params參數(shù)

1.配置路由,聲明params參數(shù)
{path:'/home',// 二級(jí)路由component:homeRouter,children:[{path:'news',component:News,},{path:'message',component:Message,children:[{name:'xijie',path:'detail/:id/:title',//使用占位符聲明接收params參數(shù)component:DetailRouter}]}]}
2.傳遞參數(shù)<!-- 跳轉(zhuǎn)路由器并攜帶params參數(shù),to的字符串寫法 -->
<router-link :to="/home/message/detai/666/你好">跳轉(zhuǎn)</router-link><!-- 跳轉(zhuǎn)路由并攜帶params參數(shù),to的對(duì)象寫法 -->
<router-link :to="{name:'xijie',params:{id:666,title:'你好'}}">跳轉(zhuǎn)</router-link>
3.特別注意:路由攜帶params參數(shù)時(shí),若使用to的對(duì)象寫法,則不能使用path配置項(xiàng),必須使用name配置
4.接收參數(shù):$route.params.id$route.para
//router的index.js detail相關(guān)部分{path:'message',component:Message,children:[{name:'xijie',path:'detail/:id/:title',//node.js的占位符,為params準(zhǔn)備component:DetailRouter}]}
//detailRouter.vue
<template><ul><li>消息編號(hào):{{$route.params.id}}</li><li>消息標(biāo)題:{{$route.params.title}}</li></ul>
</template><script>
export default {name:'DetailRouter',
}
</script><style></style>
//messageRouter.vue傳參部分<li v-for="m in messageList" :key="m.id"><!-- 跳轉(zhuǎn)路由器并攜帶params參數(shù),to的字符串寫法 --><!-- <router-link :to="`/home/message/detail/${m.id}/${m.title}`">{{m.title}}</router-link> --><!-- 跳轉(zhuǎn)路由并攜帶params參數(shù),to的對(duì)象寫法 --><router-link :to="{name:'xijie',params:{id:m.id,title:m.title}}">{{m.title}}</router-link></li>

今天寫到這 下次我們?cè)僦v解? 名路由

http://www.risenshineclean.com/news/199.html

相關(guān)文章:

  • 小微型企業(yè)網(wǎng)站建立/市場(chǎng)營(yíng)銷是做什么的
  • 網(wǎng)站開發(fā)的功能需求怎么寫/shopify seo
  • 釘釘在線課堂/大連seo建站
  • 濰坊網(wǎng)站建設(shè)價(jià)格/一個(gè)好的產(chǎn)品怎么推廣
  • 域名做違法網(wǎng)站/西安百度競(jìng)價(jià)托管代運(yùn)營(yíng)
  • 招聘網(wǎng)站開發(fā)價(jià)格/福州整站優(yōu)化
  • 德清縣城鄉(xiāng)建設(shè)局網(wǎng)站/微信朋友圈軟文大全
  • 網(wǎng)站建設(shè)公司做銷售好不好?/國(guó)內(nèi)最新新聞
  • 商業(yè)平臺(tái)網(wǎng)站開發(fā)/凡科網(wǎng)建站系統(tǒng)源碼
  • 蘇州專業(yè)做網(wǎng)站的公司/網(wǎng)站開發(fā)北京公司
  • 北京微網(wǎng)站制作/深圳競(jìng)價(jià)托管公司
  • 網(wǎng)站建設(shè)拾金手指下拉二十/百度排行榜風(fēng)云榜小說
  • 國(guó)家新聞出版署是什么機(jī)構(gòu)/揚(yáng)州seo博客
  • 重慶人才招聘網(wǎng)官網(wǎng)/重慶seo
  • 西安做網(wǎng)站南通公司/谷歌瀏覽器網(wǎng)頁版進(jìn)入
  • led網(wǎng)站建設(shè)方案模板/成人本科報(bào)考官網(wǎng)
  • 互聯(lián)網(wǎng)網(wǎng)站建設(shè)制作/長(zhǎng)沙百度推廣開戶
  • 中山網(wǎng)站制作公司/網(wǎng)站建設(shè)首頁
  • 品牌建設(shè)的路徑/網(wǎng)站排名優(yōu)化查詢
  • 江蘇今天剛剛的最新新聞/seo網(wǎng)站優(yōu)化報(bào)價(jià)
  • 中海建筑建設(shè)有限公司網(wǎng)站/seo排名賺app下載
  • 建湖做網(wǎng)站哪家公司好/seo排名優(yōu)化推廣報(bào)價(jià)
  • wordpress添加主題設(shè)置選項(xiàng)/搜索引擎優(yōu)化是指
  • 洛陽市App網(wǎng)站開發(fā)公司/挖掘愛站網(wǎng)
  • 廉江新聞最新消息/南京百度seo
  • 百度seo排名點(diǎn)擊/廣州網(wǎng)站快速優(yōu)化排名
  • 旅游網(wǎng)站開發(fā)需求分析目的/軟文寫作是什么意思
  • 網(wǎng)站怎么做關(guān)鍵詞優(yōu)化/數(shù)據(jù)統(tǒng)計(jì)網(wǎng)站有哪些
  • 上海網(wǎng)站建設(shè)培訓(xùn)班/網(wǎng)站推廣培訓(xùn)
  • 模板式網(wǎng)站建設(shè)/市場(chǎng)監(jiān)督管理局投訴電話