sadais-piui 1.2.6-beta2 → 1.2.6-beta5
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.
|
@@ -2,13 +2,7 @@
|
|
|
2
2
|
<view
|
|
3
3
|
class="pi-form-item"
|
|
4
4
|
:style="[customStyle, itemStyle]"
|
|
5
|
-
:class="[
|
|
6
|
-
{ disabled: getDisabled },
|
|
7
|
-
{ border: getBorder },
|
|
8
|
-
{ 'pi-align-center': !getWrap },
|
|
9
|
-
getFormItemClass,
|
|
10
|
-
customClass
|
|
11
|
-
]"
|
|
5
|
+
:class="[...getFormItemClass, customClass]"
|
|
12
6
|
@tap="handleItemClick"
|
|
13
7
|
>
|
|
14
8
|
<!-- 表单标题 -->
|
|
@@ -92,9 +86,9 @@ const alignFlexMap = {
|
|
|
92
86
|
}
|
|
93
87
|
|
|
94
88
|
const verticalAlignFlexMap = {
|
|
95
|
-
top: '
|
|
96
|
-
center: 'center',
|
|
97
|
-
bottom: '
|
|
89
|
+
top: 'pi-align-start',
|
|
90
|
+
center: 'pi-align-center',
|
|
91
|
+
bottom: 'pi-align-end'
|
|
98
92
|
}
|
|
99
93
|
|
|
100
94
|
export default {
|
|
@@ -364,15 +358,15 @@ export default {
|
|
|
364
358
|
}
|
|
365
359
|
},
|
|
366
360
|
getFormItemClass() {
|
|
367
|
-
const classList =
|
|
361
|
+
const classList = []
|
|
368
362
|
if (this.getDisabled) {
|
|
369
|
-
classList.disabled
|
|
363
|
+
classList.push('disabled')
|
|
370
364
|
}
|
|
371
365
|
if (this.getBorder) {
|
|
372
|
-
classList.border
|
|
366
|
+
classList.push('border')
|
|
373
367
|
}
|
|
374
368
|
if (!this.getWrap && this.getItemVerticalAlign) {
|
|
375
|
-
classList
|
|
369
|
+
classList.push(`pi-align-${this.getItemVerticalAlign}`)
|
|
376
370
|
}
|
|
377
371
|
return classList
|
|
378
372
|
}
|
|
@@ -9,27 +9,14 @@
|
|
|
9
9
|
ref="pi-subsection__bar"
|
|
10
10
|
class="pi-subsection__bar"
|
|
11
11
|
:style="[barStyle]"
|
|
12
|
-
:class="[
|
|
13
|
-
mode === 'button' && 'pi-subsection--button__bar',
|
|
14
|
-
current === 0 && mode === 'subsection' && 'pi-subsection__bar--first',
|
|
15
|
-
current > 0 &&
|
|
16
|
-
current < items.length - 1 &&
|
|
17
|
-
mode === 'subsection' &&
|
|
18
|
-
'pi-subsection__bar--center',
|
|
19
|
-
current === items.length - 1 && mode === 'subsection' && 'pi-subsection__bar--last'
|
|
20
|
-
]"
|
|
12
|
+
:class="[barClass]"
|
|
21
13
|
/>
|
|
22
14
|
<view
|
|
23
15
|
v-for="(item, index) in items"
|
|
24
16
|
:ref="`pi-subsection__item--${index}`"
|
|
25
17
|
:key="index"
|
|
26
18
|
class="pi-subsection__item"
|
|
27
|
-
:class="[
|
|
28
|
-
`pi-subsection__item--${index}`,
|
|
29
|
-
index < items.length - 1 && 'pi-subsection__item--no-border-right',
|
|
30
|
-
index === 0 && 'pi-subsection__item--first',
|
|
31
|
-
index === items.length - 1 && 'pi-subsection__item--last'
|
|
32
|
-
]"
|
|
19
|
+
:class="[itemClass(index)]"
|
|
33
20
|
:style="[itemStyle(index)]"
|
|
34
21
|
@tap="clickHandler(index)"
|
|
35
22
|
>
|
|
@@ -162,6 +149,22 @@ export default {
|
|
|
162
149
|
}
|
|
163
150
|
},
|
|
164
151
|
computed: {
|
|
152
|
+
// 滑块指定class
|
|
153
|
+
barClass() {
|
|
154
|
+
// 默认按钮模式
|
|
155
|
+
let className = 'pi-subsection--button__bar'
|
|
156
|
+
// 分段器模式
|
|
157
|
+
if (this.mode === 'subsection') {
|
|
158
|
+
if (this.current === 0) {
|
|
159
|
+
className = 'pi-subsection__bar--first'
|
|
160
|
+
} else if (this.current > 0 && this.current < this.items.length - 1) {
|
|
161
|
+
className = 'pi-subsection__bar--center'
|
|
162
|
+
} else if (this.current === this.items.length - 1) {
|
|
163
|
+
className = 'pi-subsection__bar--last'
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return className
|
|
167
|
+
},
|
|
165
168
|
wrapperStyle() {
|
|
166
169
|
const style = {}
|
|
167
170
|
// button模式时,设置背景色
|
|
@@ -212,6 +215,20 @@ export default {
|
|
|
212
215
|
return style
|
|
213
216
|
}
|
|
214
217
|
},
|
|
218
|
+
// 分段器item的class
|
|
219
|
+
itemClass(index) {
|
|
220
|
+
return (index) => {
|
|
221
|
+
let className = `pi-subsection__item--${index}`
|
|
222
|
+
if (index === 0) {
|
|
223
|
+
className += ' pi-subsection__item--first'
|
|
224
|
+
} else if (index < this.items.length - 1) {
|
|
225
|
+
className += ' pi-subsection__item--no-border-right'
|
|
226
|
+
} else if (index === this.items.length - 1) {
|
|
227
|
+
className += ' pi-subsection__item--last'
|
|
228
|
+
}
|
|
229
|
+
return className
|
|
230
|
+
}
|
|
231
|
+
},
|
|
215
232
|
// 分段器文字颜色
|
|
216
233
|
textStyle(index) {
|
|
217
234
|
return (index) => {
|