sh-view 2.0.2 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,83 +1,83 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div :class="classes" :style="styles">
|
|
3
|
-
<slot></slot>
|
|
4
|
-
</div>
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<script>
|
|
8
|
-
import './css/index.scss'
|
|
9
|
-
const prefixCls = 'sh-col'
|
|
10
|
-
function parseFlex(flex) {
|
|
11
|
-
if (typeof flex === 'number') {
|
|
12
|
-
return `${flex} ${flex} auto`
|
|
13
|
-
}
|
|
14
|
-
if (/^\d+(\.\d+)?(px|em|rem|%)$/.test(flex)) {
|
|
15
|
-
return `0 0 ${flex}`
|
|
16
|
-
}
|
|
17
|
-
return flex
|
|
18
|
-
}
|
|
19
|
-
export default {
|
|
20
|
-
name: 'ShCol',
|
|
21
|
-
inject: ['RowInstance'],
|
|
22
|
-
props: {
|
|
23
|
-
span: [Number, String],
|
|
24
|
-
order: [Number, String],
|
|
25
|
-
offset: [Number, String],
|
|
26
|
-
push: [Number, String],
|
|
27
|
-
pull: [Number, String],
|
|
28
|
-
xs: [Number, Object],
|
|
29
|
-
sm: [Number, Object],
|
|
30
|
-
md: [Number, Object],
|
|
31
|
-
lg: [Number, Object],
|
|
32
|
-
xl: [Number, Object],
|
|
33
|
-
xxl: [Number, Object],
|
|
34
|
-
flex: {
|
|
35
|
-
type: [Number, String],
|
|
36
|
-
default: ''
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
computed: {
|
|
40
|
-
gutter() {
|
|
41
|
-
return this.RowInstance?.gutter || 0
|
|
42
|
-
},
|
|
43
|
-
classes() {
|
|
44
|
-
let classList = [
|
|
45
|
-
`${prefixCls}`,
|
|
46
|
-
{
|
|
47
|
-
[`${prefixCls}-span-${this.span}`]: this.span,
|
|
48
|
-
[`${prefixCls}-order-${this.order}`]: this.order,
|
|
49
|
-
[`${prefixCls}-offset-${this.offset}`]: this.offset,
|
|
50
|
-
[`${prefixCls}-push-${this.push}`]: this.push,
|
|
51
|
-
[`${prefixCls}-pull-${this.pull}`]: this.pull
|
|
52
|
-
}
|
|
53
|
-
]
|
|
54
|
-
;['xs', 'sm', 'md', 'lg', 'xl', 'xxl'].forEach(size => {
|
|
55
|
-
if (typeof this[size] === 'number') {
|
|
56
|
-
classList.push(`${prefixCls}-span-${size}-${this[size]}`)
|
|
57
|
-
} else if (typeof this[size] === 'object') {
|
|
58
|
-
let props = this[size]
|
|
59
|
-
Object.keys(props).forEach(prop => {
|
|
60
|
-
classList.push(prop !== 'span' ? `${prefixCls}-${size}-${prop}-${props[prop]}` : `${prefixCls}
|
|
61
|
-
})
|
|
62
|
-
}
|
|
63
|
-
})
|
|
64
|
-
return classList
|
|
65
|
-
},
|
|
66
|
-
styles() {
|
|
67
|
-
let style = {}
|
|
68
|
-
if (this.gutter !== 0) {
|
|
69
|
-
style = {
|
|
70
|
-
paddingLeft: this.gutter / 2 + 'px',
|
|
71
|
-
paddingRight: this.gutter / 2 + 'px'
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
if (this.flex) {
|
|
75
|
-
style.flex = parseFlex(this.flex)
|
|
76
|
-
}
|
|
77
|
-
return style
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
</script>
|
|
82
|
-
|
|
83
|
-
<style scoped lang="scss"></style>
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="classes" :style="styles">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
import './css/index.scss'
|
|
9
|
+
const prefixCls = 'sh-col'
|
|
10
|
+
function parseFlex(flex) {
|
|
11
|
+
if (typeof flex === 'number') {
|
|
12
|
+
return `${flex} ${flex} auto`
|
|
13
|
+
}
|
|
14
|
+
if (/^\d+(\.\d+)?(px|em|rem|%)$/.test(flex)) {
|
|
15
|
+
return `0 0 ${flex}`
|
|
16
|
+
}
|
|
17
|
+
return flex
|
|
18
|
+
}
|
|
19
|
+
export default {
|
|
20
|
+
name: 'ShCol',
|
|
21
|
+
inject: ['RowInstance'],
|
|
22
|
+
props: {
|
|
23
|
+
span: [Number, String],
|
|
24
|
+
order: [Number, String],
|
|
25
|
+
offset: [Number, String],
|
|
26
|
+
push: [Number, String],
|
|
27
|
+
pull: [Number, String],
|
|
28
|
+
xs: [Number, Object],
|
|
29
|
+
sm: [Number, Object],
|
|
30
|
+
md: [Number, Object],
|
|
31
|
+
lg: [Number, Object],
|
|
32
|
+
xl: [Number, Object],
|
|
33
|
+
xxl: [Number, Object],
|
|
34
|
+
flex: {
|
|
35
|
+
type: [Number, String],
|
|
36
|
+
default: ''
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
computed: {
|
|
40
|
+
gutter() {
|
|
41
|
+
return this.RowInstance?.gutter || 0
|
|
42
|
+
},
|
|
43
|
+
classes() {
|
|
44
|
+
let classList = [
|
|
45
|
+
`${prefixCls}`,
|
|
46
|
+
{
|
|
47
|
+
[`${prefixCls}-span-${this.span}`]: this.span,
|
|
48
|
+
[`${prefixCls}-order-${this.order}`]: this.order,
|
|
49
|
+
[`${prefixCls}-offset-${this.offset}`]: this.offset,
|
|
50
|
+
[`${prefixCls}-push-${this.push}`]: this.push,
|
|
51
|
+
[`${prefixCls}-pull-${this.pull}`]: this.pull
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
;['xs', 'sm', 'md', 'lg', 'xl', 'xxl'].forEach(size => {
|
|
55
|
+
if (typeof this[size] === 'number') {
|
|
56
|
+
classList.push(`${prefixCls}-span-${size}-${this[size]}`)
|
|
57
|
+
} else if (typeof this[size] === 'object') {
|
|
58
|
+
let props = this[size]
|
|
59
|
+
Object.keys(props).forEach(prop => {
|
|
60
|
+
classList.push(prop !== 'span' ? `${prefixCls}-${size}-${prop}-${props[prop]}` : `${prefixCls}-${size}-span-${props[prop]}`)
|
|
61
|
+
})
|
|
62
|
+
}
|
|
63
|
+
})
|
|
64
|
+
return classList
|
|
65
|
+
},
|
|
66
|
+
styles() {
|
|
67
|
+
let style = {}
|
|
68
|
+
if (this.gutter !== 0) {
|
|
69
|
+
style = {
|
|
70
|
+
paddingLeft: this.gutter / 2 + 'px',
|
|
71
|
+
paddingRight: this.gutter / 2 + 'px'
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (this.flex) {
|
|
75
|
+
style.flex = parseFlex(this.flex)
|
|
76
|
+
}
|
|
77
|
+
return style
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
</script>
|
|
82
|
+
|
|
83
|
+
<style scoped lang="scss"></style>
|