博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
路由-命名视图实现经典布局
阅读量:7025 次
发布时间:2019-06-28

本文共 1323 字,大约阅读时间需要 4 分钟。

<!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>
<script src="./js/vue-2.4.0.js"></script>
<script src="./js/vue-router-3.0.1.js"></script>
<style>
html,
body {
margin: 0;
padding: 0;
}
.header {
">orange;
height: 80px;
}
h1 {
margin: 0;
padding: 0;
font-size: 16px;
}
.container {
display: flex;
height: 600px;
}
.left {
 
flex: 2;
}
.main {
 
flex: 8;
}
</style>
</head>
<body>
<div id="app">
<router-view></router-view>
<div class="container">
<router-view name="left"></router-view>
<router-view name="main"></router-view>
</div>
</div>
<script>
var header = {
template: '<h1 class="header">Header头部区域</h1>'
}
var leftBox = {
template: '<h1 class="left">Left侧边栏区域</h1>'
}
var mainBox = {
template: '<h1 class="main">mainBox主体区域</h1>'
}
// 创建路由对象
var router = new VueRouter({
routes: [
/* { path: '/', component: header },
{ path: '/left', component: leftBox },
{ path: '/main', component: mainBox } */
{
path: '/', components: {
'default': header,
'left': leftBox,
'main': mainBox
}
}
]
})
// 创建 Vue 实例,得到 ViewModel
var vm = new Vue({
el: '#app',
data: {},
methods: {},
router
});
</script>
</body>
</html>

转载于:https://www.cnblogs.com/lujieting/p/10459225.html

你可能感兴趣的文章
2013-9-11
查看>>
使用 Jersey 和 Apache Tomcat 7 构建 JAX-RS 环境
查看>>
正则的部分表达式(转载)
查看>>
hql查询
查看>>
模仿酷狗7(Kugou7)音乐魔方界面源码
查看>>
剑指offer之字符串是否为数值
查看>>
我的友情链接
查看>>
HTTP Cookie 详解
查看>>
Lab4-CUCM PUB First Configuration
查看>>
关于MS12-020 3389 0day exp 远程桌面执行代码漏洞的文章
查看>>
既然入了IT这行得不停的学习,不进则退
查看>>
本地项目上传到github
查看>>
调试Angular代码的Batarang插件不能用的问题
查看>>
文件测试
查看>>
Java指定网页打开Chrome浏览器
查看>>
设计模式-简单工厂模式(Simple Factory)
查看>>
Microsoft Visual Studio 2013 Update 1 离线安装程序
查看>>
思科路由器限速设置全解
查看>>
Java中getResourceAsStream()用法总结(转)
查看>>
52:nginx负载均衡|ssl原理|生成ssl秘钥对|nginx配置ssl
查看>>