この記事の内容は、vue.js の第 2 レベルのルーティングと第 3 レベルのルーティングに関するコード分析です。必要な方は参考にしていただければ幸いです。
なぜ二次および三次ルーティングを使用するのですか?
プロジェクト内に複数の
ルーティングが階層的でなく、複数の
ルートが階層化されている場合、2 番目または 3 番目のルートがトリガーされると、このルートが対応するコンポーネントを置き換えます。コンテンツは親ルーティング コンポーネントの
第 1 レベルのルーティングがトリガーされると、ルートの
第 2 レベルのルーティング
子属性配列を第 1 レベルのルートに追加し、第 2 レベルのルートを配置します
ジャンプ後の URL アドレス バーの表示を決定します
//main.js //一级路由 import About from './components/about/About' //二级路由 import Contact from './components/about/Contact' import Delivery from './components/about/Delivery' import History from './components/about/History' import OrderingGuide from './components/about/OrderingGuide' const router= new VueRouter({ routes:[ {path:'/about',name:'about',component:About,children:[ {path:'/about/contsssssssssssssssact',name:'contactLink',component:Contact}, {path:'/history',name:'historyLink',component:History}, {path:'/',name:'deliveryLink',component:Delivery}, {path:'/orderingGuide',name:'orderingGuideLink',component:OrderingGuide}, ]}, {path:'*',redirect:'/'} ], mode:"history" });
Third-level routing
Secondary Routingに類似
const router= new VueRouter({ routes:[ {path:'/',name:'home',component:Home}, {path:'/menu',name:'menu',component:Menu}, {path:'/admin',name:'admin',component:Admin}, {path:'/about',name:'about',component:About,redirect: {name:'contactLink'},children:[ //二级路由 {path:'/about/contact',name:'contactLink',component:Contact}, {path:'/history',name:'historyLink',component:History}, {path:'/delivery',name:'deliveryLink',component:Delivery}, {path:'/orderingGuide',name:'orderingGuideLink',component:OrderingGuide,redirect:{name:'phonelink'},children: [ //三级路由 {path:'/phone',name:'phonelink',component:Phone}, {path:'/name',name:'namelink',component:Name} ]}, ]}, {path:'/login',name:'login',component:Login}, {path:'/register',name:'register',component:Register}, {path:'*',redirect:'/'} ], mode:"history" });
関連する推奨事項:
以上がvue.js の 2 次ルーティングと 3 次ルーティングのコード分析の詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

VueUse 是 Anthony Fu 的一个开源项目,它为 Vue 开发人员提供了大量适用于 Vue 2 和 Vue 3 的基本 Composition API 实用程序函数。本篇文章就来给大家分享几个我常用的几个 VueUse 最佳组合,希望对大家有所帮助!

Vue3如何更好地使用qrcodejs生成二维码并添加文字描述?下面本篇文章给大家介绍一下Vue3+qrcodejs生成二维码并添加文字描述,希望对大家有所帮助。

本篇文章给大家整理分享8个GitHub上很棒的的 Vue 项目,都是非常棒的项目,希望当中有您想要收藏的那一个。

如何覆盖组件库样式?下面本篇文章给大家介绍一下React和Vue项目中优雅地覆盖组件库样式的方法,希望对大家有所帮助!

本篇文章带大家聊聊vue指令中的修饰符,对比一下vue中的指令修饰符和dom事件中的event对象,介绍一下常用的事件修饰符,希望对大家有所帮助!

如何使用VueRouter4.x?下面本篇文章就来给大家分享快速上手教程,介绍一下10分钟快速上手VueRouter4.x的方法,希望对大家有所帮助!


ホットAIツール

Undresser.AI Undress
リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover
写真から衣服を削除するオンライン AI ツール。

Undress AI Tool
脱衣画像を無料で

Clothoff.io
AI衣類リムーバー

AI Hentai Generator
AIヘンタイを無料で生成します。

人気の記事

ホットツール

ゼンドスタジオ 13.0.1
強力な PHP 統合開発環境

SublimeText3 中国語版
中国語版、とても使いやすい

SublimeText3 Linux 新バージョン
SublimeText3 Linux 最新バージョン

メモ帳++7.3.1
使いやすく無料のコードエディター

ドリームウィーバー CS6
ビジュアル Web 開発ツール
