内容简介:Flexbox 對於macOS Mojave 10.14.5Node 12.4.0
Flexbox 對於 間隔等距 ,主要由 justify-content 的 space 系列設定;Vuetify 的 Grid 則提供 justify-space-between 與 justify-space-around 等 props,讓我們不用 CSS 即可排版。
Version
macOS Mojave 10.14.5
Node 12.4.0
Vue CLI 3.8.4
Vue 2.6.10
Vuetify 1.5.5
Chrome 75.0.3770.100
Vue File
<template>
<v-container fluid>
<v-layout justify-space-between row1>
<v-flex xs4 item1>1</v-flex>
<v-flex xs3 item2>2</v-flex>
<v-flex xs4 item3>3</v-flex>
</v-layout>
</v-container>
</template>
<script>
export default {
name: 'App',
}
</script>
<style scoped>
.row1 {
background-color: #d3d3d3;
height: 240px;
}
.item1 {
background-color: #faa;
}
.item2 {
background-color: #afa;
}
.item3 {
background-color: #aff;
}
</style>
第 2 行
<v-container fluid>
<v-layout justify-space-between row1>
<v-flex xs4 item1>1</v-flex>
<v-flex xs3 item2>2</v-flex>
<v-flex xs4 item3>3</v-flex>
</v-layout>
</v-container>
對 3 個 <div> 做 layout。
但已經看不到 <div> 與 CSS class,取而代之是 Vuetify 的 component 與 props。
Space Between
RGB 並沒有均分 container,但 紫色 間距是相等的。
<v-container fluid>
<v-layout justify-space-between row1>
<v-flex xs4 item1>1</v-flex>
<v-flex xs3 item2>2</v-flex>
<v-flex xs4 item3>3</v-flex>
</v-layout>
</v-container>
Vuetify 的 grid system 依次使用 <v-container> 、 <v-layout> 與 <v-flex> 。
<v-layout> 相當於 CSS 的 display: flex 。
若 <v-layout> 沒設定 column props,預設為 row ,表示內容 由左至右 。
justify-space-between 表示:
-
<v-flex>與<v-flex>間隔平分<v-container>剩下寬度 - 第一個
<v-flex>與最後一個<v-flex>都貼齊<v-container>,不使用<v-container>剩下寬度
justify-space-between 相當於 CSS 的 justify-content: space-between 。
Space Around
RGB 並沒有均分 container,兩側間距為中間間距的一半。
<v-container fluid>
<v-layout justify-space-around row1>
<v-flex xs4 item1>1</v-flex>
<v-flex xs3 item2>2</v-flex>
<v-flex xs4 item3>3</v-flex>
</v-layout>
</v-container>
justify-space-around 表示:
-
<v-flex>與<v-flex>間隔平分 container 剩下寬度 - 第一個
<v-flex>與最後一個<v-flex>也會使用<v-container>剩下寬度,但只有<v-flex>與<v-flex>間寬度一半
justify-space-around 相當於 CSS 的 justify-content: space-around 。
Space Evenly
RGB 並沒有均分 container,兩側間距與中間間距相同。
<v-container fluid>
<v-layout justify-space-evenly row1>
<v-flex xs4 item1>1</v-flex>
<v-flex xs3 item2>2</v-flex>
<v-flex xs4 item3>3</v-flex>
</v-layout>
</v-container>
justify-space-evenly 表示:
-
<v-flex>與<v-flex>間隔平分v-container剩下寬度 - 第一個
<v-flex>與最後一個<v-flex>也會使用<v-container>剩下寬度,與<v-flex>與<v-flex>間寬度相等
<style scoped>
.justify-space-evenly {
justify-content: space-evenly;
}
</style>
Vuetify 目前並沒有提供 justify-space-evenly props,若要達成相同效果,只能自己定義 justify-space-evenly class。
使用自行定義的 justify-space-evenly class。
Conclusion
- 實務上
justify-space-between與justify-space-around較常使用,也因此 Vuetify 沒有提供justify-space-evenly
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网
猜你喜欢:本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
C语言常用算法分析
明日科技 / 2012-1 / 39.80元
《C语言学习路线图•C语言常用算法分析》共分为4篇,第1篇为算法基础篇,包括程序之魂——算法、数据结构基础、查找与排序算法、基本算法思想等内容;第2篇为常用算法篇,包括数学算法、矩阵与数组问题、经典算法等内容;第3篇为趣味算法篇,包括数学趣题、逻辑推理题等内容;第4篇为算法竞技篇,包括计算机等级考试算法实例、程序员考试算法实例、信息学奥赛算法实例等内容。 《C语言学习路线图•C语言常用算法分......一起来看看 《C语言常用算法分析》 这本书的介绍吧!