forked from youzan/vant
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
51 lines (45 loc) · 948 Bytes
/
index.js
File metadata and controls
51 lines (45 loc) · 948 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import { createNamespace, addUnit } from '../utils';
import { ParentMixin } from '../mixins/relation';
import { BORDER_TOP } from '../utils/constant';
const [createComponent, bem] = createNamespace('grid');
export default createComponent({
mixins: [ParentMixin('vanGrid')],
props: {
square: Boolean,
gutter: [Number, String],
iconSize: [Number, String],
clickable: Boolean,
columnNum: {
type: Number,
default: 4
},
center: {
type: Boolean,
default: true
},
border: {
type: Boolean,
default: true
}
},
computed: {
style() {
const { gutter } = this;
if (gutter) {
return {
paddingLeft: addUnit(gutter)
};
}
}
},
render() {
return (
<div
style={this.style}
class={[bem(), { [BORDER_TOP]: this.border && !this.gutter }]}
>
{this.slots()}
</div>
);
}
});