vue中align_vue中命名视图实现经典布局

html>

Document

.header {

font-size: 16px;

width: 100%;

color: #fff;

text-align: center;

background-color: red;

padding: 10px 0;

margin: 0;

}

.box {

display: flex;

}

.leftBox {

flex: 2;

height: 500px;

color: #fff;

background-color: rosybrown;

margin: 0;

}

.mainBox {

flex: 8;

height: 500px;

color: #fff;

background-color: slateblue;

margin: 0;

}

 //只需要添加name属性就会去匹配相应的名字的组件

// 组件

var header = {

template: "

header头部区域

"

}

var leftBox = {

template: "

left区域

"

}

var mainBox = {

template: "

main区域

"

}

//路由规则

var router = new VueRouter({

routes: [

{

path: '/', components: {  //components加s表示有多个组件,他为一个对象

'default': header,   //表示默认的情况下显示

'left': leftBox,   // 页面中占位符,中的name要与字符串(left名字随便起)一样 leftBox表示组件名

'main': mainBox,  // 页面中占位符,中的name要与字符串(left名字随便起)一样 leftBox表示组件名

}

}

]

})

var vm = new Vue({

el: "#app",

data: {},

methods: {},

router: router

})

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值