标签:视图 vuerouter ble code view span out r.js char
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> </head> <body> <div id="app"> <nav> <router-link to="/">邮箱设置</router-link> <router-link to="/page">个人信息设置</router-link> </nav> <router-view></router-view> <router-view name="help"></router-view> </div> <script src="../vue.js"></script> <script src="../vue-router.js"></script> <script> const com1 = { template: ` <div>邮箱设置</div> ` } const com2 = { template: ` <div>个人信息设置</div> ` } const com2Help = { template: ` <div>个人信息设置帮助</div> ` } const router = new VueRouter({ routes: [ { path: ‘/‘, component: com1 }, { path: ‘/page‘, components: { default: com2, help: com2Help } } ] }) const app = new Vue({ el: ‘#app‘, router }) </script> </body> </html>
命名视图将对应的路由组件显示在对应名字的router-view视图中
标签:视图 vuerouter ble code view span out r.js char
原文地址:https://www.cnblogs.com/bao2333/p/10278934.html