Skip to content

Commit f543fa7

Browse files
committed
feat: passing class and style properties
1 parent 634041a commit f543fa7

File tree

5 files changed

+31
-27
lines changed

5 files changed

+31
-27
lines changed

docs/App.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ h1 {
6565
border-radius: 4px 4px 0px 0px;
6666
background-color: white;
6767
padding: 24px;
68+
overflow: hidden;
6869
}
6970
main pre[class*='language-'] {
7071
margin: 0;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-grid-responsive",
3-
"version": "0.4.1",
3+
"version": "0.5.0",
44
"description": "Responsive grid system based on Bootstrap for Vue",
55
"license": "MIT",
66
"main": "dist/vue-grid-responsive.umd.js",

src/Column.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ export default {
5252
}
5353
5454
return {
55-
classGeneral: `colVGR ${this.createClassSize()}`,
56-
styleGeneral
55+
classGeneral: `${this.createClassSize()} ${this.$props.class || ''}`,
56+
styleGeneral: `${styleGeneral};${this.$props.style || ''}`
5757
};
5858
},
5959
methods: {
@@ -66,7 +66,7 @@ export default {
6666
return breakpoint ? `${(breakpoint / localColumns) * 100}%` : false;
6767
},
6868
createClassSize() {
69-
let newClass = 'grid-column colVGR-xs ';
69+
let newClass = 'colVGR colVGR-xs grid-column ';
7070
7171
newClass += this.sm ? 'colVGR-sm ' : '';
7272
newClass += this.md ? 'colVGR-md ' : '';
@@ -110,7 +110,7 @@ export default {
110110
? `--xlOffset:${this.getValue(this.xlOffset)}; `
111111
: '';
112112
113-
return newStyle;
113+
return `${newStyle};${this.$props.style || ''}`;
114114
}
115115
}
116116
};

src/Hidden.vue

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,33 @@
11
<template>
2-
<div :class="classGeneral">
2+
<div :class="classGeneral" :style="styleGeneral">
33
<slot />
44
</div>
55
</template>
66

77
<script>
88
export default {
99
name: 'Hidden',
10-
data() {
11-
return {
12-
classGeneral: `${this.createClassSize()}`
13-
};
14-
},
1510
props: {
1611
xs: Boolean,
1712
sm: Boolean,
1813
md: Boolean,
1914
lg: Boolean,
2015
xl: Boolean
2116
},
22-
methods: {
23-
createClassSize() {
17+
computed: {
18+
classGeneral() {
2419
let newClass = '';
2520
26-
newClass += this.xs ? 'hiddenVGR-xs ' : '';
27-
newClass += this.sm ? 'hiddenVGR-sm ' : '';
28-
newClass += this.md ? 'hiddenVGR-md ' : '';
29-
newClass += this.lg ? 'hiddenVGR-lg ' : '';
30-
newClass += this.xl ? 'hiddenVGR-xl ' : '';
21+
newClass += this.xs ? ' hiddenVGR-xs' : '';
22+
newClass += this.sm ? ' hiddenVGR-sm' : '';
23+
newClass += this.md ? ' hiddenVGR-md' : '';
24+
newClass += this.lg ? ' hiddenVGR-lg' : '';
25+
newClass += this.xl ? ' hiddenVGR-xl' : '';
3126
32-
return newClass;
27+
return `${newClass} ${this.$props.class || ''}`;
28+
},
29+
styleGeneral() {
30+
return this.$props.style;
3331
}
3432
}
3533
};

src/Row.vue

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div :style="styleGeneral" class="grid-row">
2+
<div :style="styleGeneral" :class="classGeneral">
33
<slot />
44
</div>
55
</template>
@@ -8,19 +8,24 @@
88
export default {
99
name: 'Row',
1010
props: {
11-
gutter: Number,
11+
gutter: {
12+
Number,
13+
default: 0
14+
},
1215
columns: {
1316
type: Number,
14-
default: 12,
15-
},
17+
default: 12
18+
}
1619
},
1720
computed: {
1821
styleGeneral() {
19-
return this.gutter
20-
? `--paddingVGR:${this.gutter / 2}px;--marginVGR:-${this.gutter / 2}px`
21-
: '--paddingVGR:0px;--marginVGR:0px';
22+
return `--paddingVGR:${this.gutter / 2}px;--marginVGR:-${this.gutter /
23+
2}px;${this.$props.style || ''}`;
24+
},
25+
classGeneral() {
26+
return `grid-row ${this.$props.class || ''}`;
2227
}
23-
},
28+
}
2429
};
2530
</script>
2631

0 commit comments

Comments
 (0)