Skip to content

Commit a6ae8d7

Browse files
committed
row column 布局属性优化
1 parent 35eae10 commit a6ae8d7

File tree

8 files changed

+195
-11
lines changed

8 files changed

+195
-11
lines changed

public/app.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/mix-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"/app.js": "/app.js?id=aa3a61559592bb7e4225",
2+
"/app.js": "/app.js?id=868d166b1127889c43e9",
33
"/manifest.js": "/manifest.js?id=8991394a854ee5cdffc3",
44
"/vendor.js": "/vendor.js?id=df0be4950fcb717193ba"
55
}

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ php artisan vendor:publish --tag=laravel-vue-admin-lang --force
6060
// 清理视图缓存
6161
php artisan view:clear
6262
```
63-
最后不要忘记清理浏览器缓存
63+
最后不要忘记清理浏览器缓存,如果有CDN也要更新CDN的缓存
6464

6565
# 感谢
6666

resources/js/components/grid/Table.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@
165165
</el-table-column>
166166
</el-table>
167167
</div>
168-
<div class="table-page padding-sm">
168+
<div class="table-page padding-xs">
169169
<el-pagination
170170
:layout="attrs.pageLayout"
171171
:hide-on-single-page="false"

resources/js/components/layout/Column.vue

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
<template>
2-
<el-col :span="attrs.width" :style="attrs.style" :class="attrs.className">
2+
<el-col
3+
:span="attrs.width"
4+
:offset="attrs.offset"
5+
:push='attrs.push'
6+
:pull='attrs.pull'
7+
:xs='attrs.xs'
8+
:sm='attrs.sm'
9+
:md='attrs.md'
10+
:lg='attrs.lg'
11+
:xl='attrs.xl'
12+
:tag='attrs.tag'
13+
:style="attrs.style"
14+
:class="attrs.className"
15+
>
316
<component
417
v-for="(content, index) in attrs.contents"
518
:key="index"
@@ -13,8 +26,8 @@
1326
<script>
1427
export default {
1528
props: {
16-
attrs: Object
17-
}
29+
attrs: Object,
30+
},
1831
};
1932
</script>
2033

resources/js/components/layout/Row.vue

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
<template>
2-
<el-row :gutter="attrs.gutter" :style="attrs.style" :class="attrs.className">
2+
<el-row
3+
:gutter="attrs.gutter"
4+
:type="attrs.type"
5+
:justify="attrs.justify"
6+
:align="attrs.align"
7+
:tag="attrs.tag"
8+
:style="attrs.style"
9+
:class="attrs.className"
10+
>
311
<component
412
v-for="(column, index) in attrs.columns"
513
:key="index"
@@ -13,8 +21,8 @@
1321
<script>
1422
export default {
1523
props: {
16-
attrs: Object
17-
}
24+
attrs: Object,
25+
},
1826
};
1927
</script>
2028

src/Layout/Column.php

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,16 @@ class Column extends Component
1313

1414
protected $width = 24;
1515

16+
protected $span;
17+
protected $offset;
18+
protected $push;
19+
protected $pull;
20+
protected $xs;
21+
protected $md;
22+
protected $lg;
23+
protected $xl;
24+
protected $tag;
25+
1626
protected $contents = [];
1727

1828
public function __construct($content, $width = 24)
@@ -43,4 +53,106 @@ public function row($content)
4353
$this->append($row);
4454
}
4555

56+
/**
57+
* @param mixed $span
58+
* @return $this
59+
*/
60+
public function span($span)
61+
{
62+
$this->span = $span;
63+
return $this;
64+
}
65+
66+
/**
67+
* @param mixed $offset
68+
* @return $this
69+
*/
70+
public function offset($offset)
71+
{
72+
$this->offset = $offset;
73+
return $this;
74+
}
75+
76+
/**
77+
* @param mixed $push
78+
* @return $this
79+
*/
80+
public function push($push)
81+
{
82+
$this->push = $push;
83+
return $this;
84+
}
85+
86+
/**
87+
* @param mixed $pull
88+
* @return $this
89+
*/
90+
public function pull($pull)
91+
{
92+
$this->pull = $pull;
93+
return $this;
94+
}
95+
96+
/**
97+
* @param mixed $xs
98+
* @return $this
99+
*/
100+
public function xs($xs)
101+
{
102+
$this->xs = $xs;
103+
return $this;
104+
}
105+
106+
/**
107+
* @param mixed $md
108+
* @return $this
109+
*/
110+
public function md($md)
111+
{
112+
$this->md = $md;
113+
return $this;
114+
}
115+
116+
/**
117+
* @param mixed $lg
118+
* @return $this
119+
*/
120+
public function lg($lg)
121+
{
122+
$this->lg = $lg;
123+
return $this;
124+
}
125+
126+
/**
127+
* @param mixed $xl
128+
* @return $this
129+
*/
130+
public function xl($xl)
131+
{
132+
$this->xl = $xl;
133+
return $this;
134+
}
135+
136+
/**
137+
* @param mixed $tag
138+
* @return $this
139+
*/
140+
public function tag($tag)
141+
{
142+
$this->tag = $tag;
143+
return $this;
144+
}
145+
146+
/**
147+
* @param array $contents
148+
* @return $this
149+
*/
150+
public function contents(array $contents)
151+
{
152+
$this->contents = $contents;
153+
return $this;
154+
}
155+
156+
157+
46158
}

src/Layout/Row.php

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ class Row extends Component
1616
protected $columns = [];
1717

1818
protected $gutter = 0;
19+
protected $type;
20+
protected $justify = "start";
21+
protected $align = "top";
22+
protected $tag = "div";
1923

2024
public function __construct($content = '')
2125
{
@@ -31,7 +35,7 @@ public function item($item)
3135
{
3236
if ($item instanceof \Closure) {
3337
$this->addColumn(call_user_func($item));
34-
}else{
38+
} else {
3539
$this->addColumn($item);
3640
}
3741

@@ -61,4 +65,51 @@ public function gutter($gutter)
6165
$this->gutter = $gutter;
6266
return $this;
6367
}
68+
69+
/**
70+
* 布局模式,可选 flex,现代浏览器下有效
71+
* @param mixed $type
72+
* @return $this
73+
*/
74+
public function type($type)
75+
{
76+
$this->type = $type;
77+
return $this;
78+
}
79+
80+
/**
81+
* flex 布局下的水平排列方式
82+
* start/end/center/space-around/space-between
83+
* @param string $justify
84+
* @return $this
85+
*/
86+
public function justify(string $justify)
87+
{
88+
$this->justify = $justify;
89+
return $this;
90+
}
91+
92+
/**
93+
* flex 布局下的垂直排列方式
94+
* @param string $align
95+
* @return $this
96+
*/
97+
public function align(string $align)
98+
{
99+
$this->align = $align;
100+
return $this;
101+
}
102+
103+
/**
104+
* 自定义元素标签
105+
* @param string $tag
106+
* @return $this
107+
*/
108+
public function tag(string $tag)
109+
{
110+
$this->tag = $tag;
111+
return $this;
112+
}
113+
114+
64115
}

0 commit comments

Comments
 (0)