|
@@ -39,32 +39,63 @@
|
|
|
|
|
|
::: demo 通过 row 和 col 组件,并通过 col 组件的 `span` 属性我们就可以自由地组合布局。
|
|
|
```html
|
|
|
-<el-row>
|
|
|
- <el-col :span="24"><div class="grid-content bg-purple-dark"></div></el-col>
|
|
|
-</el-row>
|
|
|
-<el-row>
|
|
|
- <el-col :span="12"><div class="grid-content bg-purple"></div></el-col>
|
|
|
- <el-col :span="12"><div class="grid-content bg-purple-light"></div></el-col>
|
|
|
-</el-row>
|
|
|
-<el-row>
|
|
|
- <el-col :span="8"><div class="grid-content bg-purple"></div></el-col>
|
|
|
- <el-col :span="8"><div class="grid-content bg-purple-light"></div></el-col>
|
|
|
- <el-col :span="8"><div class="grid-content bg-purple"></div></el-col>
|
|
|
-</el-row>
|
|
|
-<el-row>
|
|
|
- <el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
|
|
|
- <el-col :span="6"><div class="grid-content bg-purple-light"></div></el-col>
|
|
|
- <el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
|
|
|
- <el-col :span="6"><div class="grid-content bg-purple-light"></div></el-col>
|
|
|
-</el-row>
|
|
|
-<el-row>
|
|
|
- <el-col :span="4"><div class="grid-content bg-purple"></div></el-col>
|
|
|
- <el-col :span="4"><div class="grid-content bg-purple-light"></div></el-col>
|
|
|
- <el-col :span="4"><div class="grid-content bg-purple"></div></el-col>
|
|
|
- <el-col :span="4"><div class="grid-content bg-purple-light"></div></el-col>
|
|
|
- <el-col :span="4"><div class="grid-content bg-purple"></div></el-col>
|
|
|
- <el-col :span="4"><div class="grid-content bg-purple-light"></div></el-col>
|
|
|
-</el-row>
|
|
|
+<template>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="24"><div class="grid-content bg-purple-dark"></div></el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="12"><div class="grid-content bg-purple"></div></el-col>
|
|
|
+ <el-col :span="12"><div class="grid-content bg-purple-light"></div></el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="8"><div class="grid-content bg-purple"></div></el-col>
|
|
|
+ <el-col :span="8"><div class="grid-content bg-purple-light"></div></el-col>
|
|
|
+ <el-col :span="8"><div class="grid-content bg-purple"></div></el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
|
|
|
+ <el-col :span="6"><div class="grid-content bg-purple-light"></div></el-col>
|
|
|
+ <el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
|
|
|
+ <el-col :span="6"><div class="grid-content bg-purple-light"></div></el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="4"><div class="grid-content bg-purple"></div></el-col>
|
|
|
+ <el-col :span="4"><div class="grid-content bg-purple-light"></div></el-col>
|
|
|
+ <el-col :span="4"><div class="grid-content bg-purple"></div></el-col>
|
|
|
+ <el-col :span="4"><div class="grid-content bg-purple-light"></div></el-col>
|
|
|
+ <el-col :span="4"><div class="grid-content bg-purple"></div></el-col>
|
|
|
+ <el-col :span="4"><div class="grid-content bg-purple-light"></div></el-col>
|
|
|
+ </el-row>
|
|
|
+</template>
|
|
|
+
|
|
|
+<style>
|
|
|
+.el-row {
|
|
|
+ margin-bottom: 20px;
|
|
|
+ &:last-child {
|
|
|
+ margin-bottom: 0;
|
|
|
+ }
|
|
|
+}
|
|
|
+.el-col {
|
|
|
+ border-radius: 4px;
|
|
|
+}
|
|
|
+.bg-purple-dark {
|
|
|
+ background: #99a9bf;
|
|
|
+}
|
|
|
+.bg-purple {
|
|
|
+ background: #d3dce6;
|
|
|
+}
|
|
|
+.bg-purple-light {
|
|
|
+ background: #e5e9f2;
|
|
|
+}
|
|
|
+.grid-content {
|
|
|
+ border-radius: 4px;
|
|
|
+ min-height: 36px;
|
|
|
+}
|
|
|
+.row-bg {
|
|
|
+ padding: 10px 0;
|
|
|
+ background-color: #f9fafc;
|
|
|
+}
|
|
|
+</style>
|
|
|
```
|
|
|
:::
|
|
|
|
|
@@ -74,12 +105,43 @@
|
|
|
|
|
|
::: demo Row 组件 提供 `gutter` 属性来指定每一栏之间的间隔,默认间隔为 0。
|
|
|
```html
|
|
|
-<el-row :gutter="20">
|
|
|
- <el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
|
|
|
- <el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
|
|
|
- <el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
|
|
|
- <el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
|
|
|
-</el-row>
|
|
|
+<template>
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
|
|
|
+ <el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
|
|
|
+ <el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
|
|
|
+ <el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
|
|
|
+ </el-row>
|
|
|
+</template>
|
|
|
+
|
|
|
+<style>
|
|
|
+.el-row {
|
|
|
+ margin-bottom: 20px;
|
|
|
+ &:last-child {
|
|
|
+ margin-bottom: 0;
|
|
|
+ }
|
|
|
+}
|
|
|
+.el-col {
|
|
|
+ border-radius: 4px;
|
|
|
+}
|
|
|
+.bg-purple-dark {
|
|
|
+ background: #99a9bf;
|
|
|
+}
|
|
|
+.bg-purple {
|
|
|
+ background: #d3dce6;
|
|
|
+}
|
|
|
+.bg-purple-light {
|
|
|
+ background: #e5e9f2;
|
|
|
+}
|
|
|
+.grid-content {
|
|
|
+ border-radius: 4px;
|
|
|
+ min-height: 36px;
|
|
|
+}
|
|
|
+.row-bg {
|
|
|
+ padding: 10px 0;
|
|
|
+ background-color: #f9fafc;
|
|
|
+}
|
|
|
+</style>
|
|
|
```
|
|
|
:::
|
|
|
|
|
@@ -89,21 +151,52 @@
|
|
|
|
|
|
::: demo
|
|
|
```html
|
|
|
-<el-row :gutter="20">
|
|
|
- <el-col :span="16"><div class="grid-content bg-purple"></div></el-col>
|
|
|
- <el-col :span="8"><div class="grid-content bg-purple"></div></el-col>
|
|
|
-</el-row>
|
|
|
-<el-row :gutter="20">
|
|
|
- <el-col :span="8"><div class="grid-content bg-purple"></div></el-col>
|
|
|
- <el-col :span="8"><div class="grid-content bg-purple"></div></el-col>
|
|
|
- <el-col :span="4"><div class="grid-content bg-purple"></div></el-col>
|
|
|
- <el-col :span="4"><div class="grid-content bg-purple"></div></el-col>
|
|
|
-</el-row>
|
|
|
-<el-row :gutter="20">
|
|
|
- <el-col :span="4"><div class="grid-content bg-purple"></div></el-col>
|
|
|
- <el-col :span="16"><div class="grid-content bg-purple"></div></el-col>
|
|
|
- <el-col :span="4"><div class="grid-content bg-purple"></div></el-col>
|
|
|
-</el-row>
|
|
|
+<template>
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <el-col :span="16"><div class="grid-content bg-purple"></div></el-col>
|
|
|
+ <el-col :span="8"><div class="grid-content bg-purple"></div></el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <el-col :span="8"><div class="grid-content bg-purple"></div></el-col>
|
|
|
+ <el-col :span="8"><div class="grid-content bg-purple"></div></el-col>
|
|
|
+ <el-col :span="4"><div class="grid-content bg-purple"></div></el-col>
|
|
|
+ <el-col :span="4"><div class="grid-content bg-purple"></div></el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <el-col :span="4"><div class="grid-content bg-purple"></div></el-col>
|
|
|
+ <el-col :span="16"><div class="grid-content bg-purple"></div></el-col>
|
|
|
+ <el-col :span="4"><div class="grid-content bg-purple"></div></el-col>
|
|
|
+ </el-row>
|
|
|
+</template>
|
|
|
+
|
|
|
+<style>
|
|
|
+.el-row {
|
|
|
+ margin-bottom: 20px;
|
|
|
+ &:last-child {
|
|
|
+ margin-bottom: 0;
|
|
|
+ }
|
|
|
+}
|
|
|
+.el-col {
|
|
|
+ border-radius: 4px;
|
|
|
+}
|
|
|
+.bg-purple-dark {
|
|
|
+ background: #99a9bf;
|
|
|
+}
|
|
|
+.bg-purple {
|
|
|
+ background: #d3dce6;
|
|
|
+}
|
|
|
+.bg-purple-light {
|
|
|
+ background: #e5e9f2;
|
|
|
+}
|
|
|
+.grid-content {
|
|
|
+ border-radius: 4px;
|
|
|
+ min-height: 36px;
|
|
|
+}
|
|
|
+.row-bg {
|
|
|
+ padding: 10px 0;
|
|
|
+ background-color: #f9fafc;
|
|
|
+}
|
|
|
+</style>
|
|
|
```
|
|
|
:::
|
|
|
|
|
@@ -113,17 +206,48 @@
|
|
|
|
|
|
::: demo 通过制定 col 组件的 `offset` 属性可以指定分栏偏移的栏数。
|
|
|
```html
|
|
|
-<el-row :gutter="20">
|
|
|
- <el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
|
|
|
- <el-col :span="6" :offset="6"><div class="grid-content bg-purple"></div></el-col>
|
|
|
-</el-row>
|
|
|
-<el-row :gutter="20">
|
|
|
- <el-col :span="6" :offset="6"><div class="grid-content bg-purple"></div></el-col>
|
|
|
- <el-col :span="6" :offset="6"><div class="grid-content bg-purple"></div></el-col>
|
|
|
-</el-row>
|
|
|
-<el-row :gutter="20">
|
|
|
- <el-col :span="12" :offset="6"><div class="grid-content bg-purple"></div></el-col>
|
|
|
-</el-row>
|
|
|
+<template>
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
|
|
|
+ <el-col :span="6" :offset="6"><div class="grid-content bg-purple"></div></el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <el-col :span="6" :offset="6"><div class="grid-content bg-purple"></div></el-col>
|
|
|
+ <el-col :span="6" :offset="6"><div class="grid-content bg-purple"></div></el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <el-col :span="12" :offset="6"><div class="grid-content bg-purple"></div></el-col>
|
|
|
+ </el-row>
|
|
|
+</template>
|
|
|
+
|
|
|
+<style>
|
|
|
+.el-row {
|
|
|
+ margin-bottom: 20px;
|
|
|
+ &:last-child {
|
|
|
+ margin-bottom: 0;
|
|
|
+ }
|
|
|
+}
|
|
|
+.el-col {
|
|
|
+ border-radius: 4px;
|
|
|
+}
|
|
|
+.bg-purple-dark {
|
|
|
+ background: #99a9bf;
|
|
|
+}
|
|
|
+.bg-purple {
|
|
|
+ background: #d3dce6;
|
|
|
+}
|
|
|
+.bg-purple-light {
|
|
|
+ background: #e5e9f2;
|
|
|
+}
|
|
|
+.grid-content {
|
|
|
+ border-radius: 4px;
|
|
|
+ min-height: 36px;
|
|
|
+}
|
|
|
+.row-bg {
|
|
|
+ padding: 10px 0;
|
|
|
+ background-color: #f9fafc;
|
|
|
+}
|
|
|
+</style>
|
|
|
```
|
|
|
:::
|
|
|
|
|
@@ -133,31 +257,62 @@
|
|
|
|
|
|
::: demo 将 `type` 属性赋值为 'flex',可以启用 flex 布局,并可通过 `justify` 属性来指定 start, center, end, space-between, space-around 其中的值来定义子元素的排版方式。
|
|
|
```html
|
|
|
-<el-row type="flex" class="row-bg">
|
|
|
- <el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
|
|
|
- <el-col :span="6"><div class="grid-content bg-purple-light"></div></el-col>
|
|
|
- <el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
|
|
|
-</el-row>
|
|
|
-<el-row type="flex" class="row-bg" justify="center">
|
|
|
- <el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
|
|
|
- <el-col :span="6"><div class="grid-content bg-purple-light"></div></el-col>
|
|
|
- <el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
|
|
|
-</el-row>
|
|
|
-<el-row type="flex" class="row-bg" justify="end">
|
|
|
- <el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
|
|
|
- <el-col :span="6"><div class="grid-content bg-purple-light"></div></el-col>
|
|
|
- <el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
|
|
|
-</el-row>
|
|
|
-<el-row type="flex" class="row-bg" justify="space-between">
|
|
|
- <el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
|
|
|
- <el-col :span="6"><div class="grid-content bg-purple-light"></div></el-col>
|
|
|
- <el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
|
|
|
-</el-row>
|
|
|
-<el-row type="flex" class="row-bg" justify="space-around">
|
|
|
- <el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
|
|
|
- <el-col :span="6"><div class="grid-content bg-purple-light"></div></el-col>
|
|
|
- <el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
|
|
|
-</el-row>
|
|
|
+<template>
|
|
|
+ <el-row type="flex" class="row-bg">
|
|
|
+ <el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
|
|
|
+ <el-col :span="6"><div class="grid-content bg-purple-light"></div></el-col>
|
|
|
+ <el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row type="flex" class="row-bg" justify="center">
|
|
|
+ <el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
|
|
|
+ <el-col :span="6"><div class="grid-content bg-purple-light"></div></el-col>
|
|
|
+ <el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row type="flex" class="row-bg" justify="end">
|
|
|
+ <el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
|
|
|
+ <el-col :span="6"><div class="grid-content bg-purple-light"></div></el-col>
|
|
|
+ <el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row type="flex" class="row-bg" justify="space-between">
|
|
|
+ <el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
|
|
|
+ <el-col :span="6"><div class="grid-content bg-purple-light"></div></el-col>
|
|
|
+ <el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row type="flex" class="row-bg" justify="space-around">
|
|
|
+ <el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
|
|
|
+ <el-col :span="6"><div class="grid-content bg-purple-light"></div></el-col>
|
|
|
+ <el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
|
|
|
+ </el-row>
|
|
|
+</template>
|
|
|
+
|
|
|
+<style>
|
|
|
+.el-row {
|
|
|
+ margin-bottom: 20px;
|
|
|
+ &:last-child {
|
|
|
+ margin-bottom: 0;
|
|
|
+ }
|
|
|
+}
|
|
|
+.el-col {
|
|
|
+ border-radius: 4px;
|
|
|
+}
|
|
|
+.bg-purple-dark {
|
|
|
+ background: #99a9bf;
|
|
|
+}
|
|
|
+.bg-purple {
|
|
|
+ background: #d3dce6;
|
|
|
+}
|
|
|
+.bg-purple-light {
|
|
|
+ background: #e5e9f2;
|
|
|
+}
|
|
|
+.grid-content {
|
|
|
+ border-radius: 4px;
|
|
|
+ min-height: 36px;
|
|
|
+}
|
|
|
+.row-bg {
|
|
|
+ padding: 10px 0;
|
|
|
+ background-color: #f9fafc;
|
|
|
+}
|
|
|
+</style>
|
|
|
```
|
|
|
:::
|
|
|
|