File tree Expand file tree Collapse file tree 10 files changed +65
-31
lines changed
pages/components/form/pages/input Expand file tree Collapse file tree 10 files changed +65
-31
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,11 @@ Component({
16
16
type : String ,
17
17
value : ''
18
18
} ,
19
+ // 是否隐藏label
20
+ hideLabel :{
21
+ type : Boolean ,
22
+ value : false
23
+ } ,
19
24
// 是否自定义label部分
20
25
labelCustom : {
21
26
type : Boolean ,
@@ -119,18 +124,18 @@ Component({
119
124
value
120
125
} ) ;
121
126
122
- this . triggerEvent ( 'linchange' , event ) ;
127
+ this . triggerEvent ( 'linchange' , event . detail ) ;
123
128
} ,
124
129
125
130
handleInputFocus ( event ) {
126
- this . triggerEvent ( 'linfocus' , event ) ;
131
+ this . triggerEvent ( 'linfocus' , event . detail ) ;
127
132
} ,
128
133
129
134
handleInputBlur ( event ) {
130
135
this . validatorData ( {
131
136
value : event . detail . value
132
137
} ) ;
133
- this . triggerEvent ( 'linblur' , event ) ;
138
+ this . triggerEvent ( 'linblur' , event . detail ) ;
134
139
} ,
135
140
handleInputConfirm ( event ) {
136
141
const {
@@ -144,13 +149,13 @@ Component({
144
149
value
145
150
} ) ;
146
151
147
- this . triggerEvent ( 'linconfirm' , event ) ;
152
+ this . triggerEvent ( 'linconfirm' , event . detail ) ;
148
153
} ,
149
154
onClearTap ( event ) {
150
155
this . setData ( {
151
156
value : ''
152
157
} )
153
- this . triggerEvent ( 'linclear' , event ) ;
158
+ this . triggerEvent ( 'linclear' , event . detail ) ;
154
159
} ,
155
160
}
156
161
} )
Original file line number Diff line number Diff line change 4
4
style="width:{{width}}rpx">
5
5
<view class='mask' wx:if="{{disabled}}"></view>
6
6
<view class='row' hidden="{{ showRow ? '' : 'hidden' }}" style="width:{{width}}rpx;"></view>
7
- <view wx:if="{{label && !labelCustom}}" class='form-label l-label-class form-label-{{labelLayout}}' style='{{labelLayout !== "top" ? "width:"+ labelWidth+ "rpx;" : "" }} height:{{labelLayout== "top" ? labelWidth + "rpx" : "" }}'>
7
+ <view wx:if="{{label && !labelCustom}}" hidden="{{hideLabel}}" class='form-label l-label-class form-label-{{labelLayout}}' style='{{labelLayout !== "top" ? "width:"+ labelWidth+ "rpx;" : "" }} height:{{labelLayout== "top" ? labelWidth + "rpx" : "" }}'>
8
8
<text><text class='text-require' wx:if="{{required}}">* </text>{{label}}<text wx:if="{{colon}}">:</text>
9
9
</text>
10
10
</view>
11
- <view wx:else class='form-label l-label-class form-label-{{labelLayout}}' style='{{labelLayout !== "top" ? "width:"+ labelWidth+ "rpx;" : "" }} height:{{labelLayout== "top" ? labelWidth + "rpx" : "" }}'>
11
+ <view wx:else hidden="{{hideLabel}}" class='form-label l-label-class form-label-{{labelLayout}}' style='{{labelLayout !== "top" ? "width:"+ labelWidth+ "rpx;" : "" }} height:{{labelLayout== "top" ? labelWidth + "rpx" : "" }}'>
12
12
<slot name="left" />
13
13
</view>
14
14
<!-- 小程序表单组件 -->
15
15
<input
16
- class="input"
16
+ class="input {{hideLabel?'hideLabel':''}} "
17
17
value="{{ value }}"
18
18
type="{{type}}"
19
19
password="{{type==='password'}}"
Original file line number Diff line number Diff line change 1
- .form-item{position:relative;font-size:28rpx;color:#333;width:750rpx;height:88rpx;display:flex;flex-direction:row;align-items:center;padding-right:25rpx;box-sizing:border-box}.row{position:absolute;bottom:0;right:0;height:2rpx;width:730rpx;background:#f3f3f3}.text-require{color:#e23;vertical-align:middle}.form-label{display:flex;flex-direction:row;align-items:center;height:88rpx;padding-left:25rpx;padding-right:15rpx;box-sizing:border-box}.disabled{color:#9a9a9a!important}.mask{position:absolute;z-index:999;height:100%;width:100%}.form-label-right{justify-content:flex-end}.form-label-left{justify-content:flex-start}.input{height:100%;line-height:100%;flex:1}.close{height:36rpx;width:36rpx;background:#ddd;display:flex;flex-direction:row;align-items:center;justify-content:center;border-radius:50%;margin-right:20rpx}.pls-class{color:#9a9a9a}
1
+ .form-item{position:relative;font-size:28rpx;color:#333;width:750rpx;height:88rpx;display:flex;flex-direction:row;align-items:center;padding-right:25rpx;box-sizing:border-box}.row{position:absolute;bottom:0;right:0;height:2rpx;width:730rpx;background:#f3f3f3}.text-require{color:#e23;vertical-align:middle}.form-label{display:flex;flex-direction:row;align-items:center;height:88rpx;padding-left:25rpx;padding-right:15rpx;box-sizing:border-box}.disabled{color:#9a9a9a!important}.mask{position:absolute;z-index:999;height:100%;width:100%}.form-label-right{justify-content:flex-end}.form-label-left{justify-content:flex-start}.input{height:100%;line-height:100%;flex:1}.close{height:36rpx;width:36rpx;background:#ddd;display:flex;flex-direction:row;align-items:center;justify-content:center;border-radius:50%;margin-right:20rpx}.pls-class{color:#9a9a9a}.hideLabel{padding-left:25rpx}
Original file line number Diff line number Diff line change @@ -16,6 +16,11 @@ Component({
16
16
type : String ,
17
17
value : ''
18
18
} ,
19
+ // 是否隐藏label
20
+ hideLabel :{
21
+ type : Boolean ,
22
+ value : false
23
+ } ,
19
24
// 是否自定义label部分
20
25
labelCustom : {
21
26
type : Boolean ,
@@ -119,18 +124,18 @@ Component({
119
124
value
120
125
} ) ;
121
126
122
- this . triggerEvent ( 'linchange' , event ) ;
127
+ this . triggerEvent ( 'linchange' , event . detail ) ;
123
128
} ,
124
129
125
130
handleInputFocus ( event ) {
126
- this . triggerEvent ( 'linfocus' , event ) ;
131
+ this . triggerEvent ( 'linfocus' , event . detail ) ;
127
132
} ,
128
133
129
134
handleInputBlur ( event ) {
130
135
this . validatorData ( {
131
136
value : event . detail . value
132
137
} ) ;
133
- this . triggerEvent ( 'linblur' , event ) ;
138
+ this . triggerEvent ( 'linblur' , event . detail ) ;
134
139
} ,
135
140
handleInputConfirm ( event ) {
136
141
const {
@@ -144,13 +149,13 @@ Component({
144
149
value
145
150
} ) ;
146
151
147
- this . triggerEvent ( 'linconfirm' , event ) ;
152
+ this . triggerEvent ( 'linconfirm' , event . detail ) ;
148
153
} ,
149
154
onClearTap ( event ) {
150
155
this . setData ( {
151
156
value : ''
152
157
} )
153
- this . triggerEvent ( 'linclear' , event ) ;
158
+ this . triggerEvent ( 'linclear' , event . detail ) ;
154
159
} ,
155
160
}
156
161
} )
Original file line number Diff line number Diff line change 4
4
style="width:{{width}}rpx">
5
5
<view class='mask' wx:if="{{disabled}}"></view>
6
6
<view class='row' hidden="{{ showRow ? '' : 'hidden' }}" style="width:{{width}}rpx;"></view>
7
- <view wx:if="{{label && !labelCustom}}" class='form-label l-label-class form-label-{{labelLayout}}' style='{{labelLayout !== "top" ? "width:"+ labelWidth+ "rpx;" : "" }} height:{{labelLayout== "top" ? labelWidth + "rpx" : "" }}'>
7
+ <view wx:if="{{label && !labelCustom}}" hidden="{{hideLabel}}" class='form-label l-label-class form-label-{{labelLayout}}' style='{{labelLayout !== "top" ? "width:"+ labelWidth+ "rpx;" : "" }} height:{{labelLayout== "top" ? labelWidth + "rpx" : "" }}'>
8
8
<text><text class='text-require' wx:if="{{required}}">* </text>{{label}}<text wx:if="{{colon}}">:</text>
9
9
</text>
10
10
</view>
11
- <view wx:else class='form-label l-label-class form-label-{{labelLayout}}' style='{{labelLayout !== "top" ? "width:"+ labelWidth+ "rpx;" : "" }} height:{{labelLayout== "top" ? labelWidth + "rpx" : "" }}'>
11
+ <view wx:else hidden="{{hideLabel}}" class='form-label l-label-class form-label-{{labelLayout}}' style='{{labelLayout !== "top" ? "width:"+ labelWidth+ "rpx;" : "" }} height:{{labelLayout== "top" ? labelWidth + "rpx" : "" }}'>
12
12
<slot name="left" />
13
13
</view>
14
14
<!-- 小程序表单组件 -->
15
15
<input
16
- class="input"
16
+ class="input {{hideLabel?'hideLabel':''}} "
17
17
value="{{ value }}"
18
18
type="{{type}}"
19
19
password="{{type==='password'}}"
Original file line number Diff line number Diff line change 1
- .form-item{position:relative;font-size:28rpx;color:#333;width:750rpx;height:88rpx;display:flex;flex-direction:row;align-items:center;padding-right:25rpx;box-sizing:border-box}.row{position:absolute;bottom:0;right:0;height:2rpx;width:730rpx;background:#f3f3f3}.text-require{color:#e23;vertical-align:middle}.form-label{display:flex;flex-direction:row;align-items:center;height:88rpx;padding-left:25rpx;padding-right:15rpx;box-sizing:border-box}.disabled{color:#9a9a9a!important}.mask{position:absolute;z-index:999;height:100%;width:100%}.form-label-right{justify-content:flex-end}.form-label-left{justify-content:flex-start}.input{height:100%;line-height:100%;flex:1}.close{height:36rpx;width:36rpx;background:#ddd;display:flex;flex-direction:row;align-items:center;justify-content:center;border-radius:50%;margin-right:20rpx}.pls-class{color:#9a9a9a}
1
+ .form-item{position:relative;font-size:28rpx;color:#333;width:750rpx;height:88rpx;display:flex;flex-direction:row;align-items:center;padding-right:25rpx;box-sizing:border-box}.row{position:absolute;bottom:0;right:0;height:2rpx;width:730rpx;background:#f3f3f3}.text-require{color:#e23;vertical-align:middle}.form-label{display:flex;flex-direction:row;align-items:center;height:88rpx;padding-left:25rpx;padding-right:15rpx;box-sizing:border-box}.disabled{color:#9a9a9a!important}.mask{position:absolute;z-index:999;height:100%;width:100%}.form-label-right{justify-content:flex-end}.form-label-left{justify-content:flex-start}.input{height:100%;line-height:100%;flex:1}.close{height:36rpx;width:36rpx;background:#ddd;display:flex;flex-direction:row;align-items:center;justify-content:center;border-radius:50%;margin-right:20rpx}.pls-class{color:#9a9a9a}.hideLabel{padding-left:25rpx}
Original file line number Diff line number Diff line change 95
95
</view>
96
96
</content-card>
97
97
98
+ <content-card
99
+ class="content"
100
+ name="隐藏左侧label"
101
+ >
102
+ <view class='buttun-wrapper'>
103
+ <l-input
104
+ label="标题"
105
+ placeholder="这里没有隐藏标题"
106
+ label-width="170"/>
107
+ <l-input
108
+ label="清除按钮"
109
+ clear="{{true}}"
110
+ label-width="170"
111
+ hideLabel="{{true}}"
112
+ placeholder="这里隐藏了标题" />
113
+ </view>
114
+ </content-card>
115
+
98
116
<content-card
99
117
class="content"
100
118
name="经典案例"
Original file line number Diff line number Diff line change @@ -16,6 +16,11 @@ Component({
16
16
type : String ,
17
17
value : ''
18
18
} ,
19
+ // 是否隐藏label
20
+ hideLabel :{
21
+ type : Boolean ,
22
+ value : false
23
+ } ,
19
24
// 是否自定义label部分
20
25
labelCustom : {
21
26
type : Boolean ,
@@ -119,18 +124,18 @@ Component({
119
124
value
120
125
} ) ;
121
126
122
- this . triggerEvent ( 'linchange' , event ) ;
127
+ this . triggerEvent ( 'linchange' , event . detail ) ;
123
128
} ,
124
129
125
130
handleInputFocus ( event ) {
126
- this . triggerEvent ( 'linfocus' , event ) ;
131
+ this . triggerEvent ( 'linfocus' , event . detail ) ;
127
132
} ,
128
133
129
134
handleInputBlur ( event ) {
130
135
this . validatorData ( {
131
136
value : event . detail . value
132
137
} ) ;
133
- this . triggerEvent ( 'linblur' , event ) ;
138
+ this . triggerEvent ( 'linblur' , event . detail ) ;
134
139
} ,
135
140
handleInputConfirm ( event ) {
136
141
const {
@@ -144,13 +149,13 @@ Component({
144
149
value
145
150
} ) ;
146
151
147
- this . triggerEvent ( 'linconfirm' , event ) ;
152
+ this . triggerEvent ( 'linconfirm' , event . detail ) ;
148
153
} ,
149
154
onClearTap ( event ) {
150
155
this . setData ( {
151
156
value : ''
152
157
} )
153
- this . triggerEvent ( 'linclear' , event ) ;
158
+ this . triggerEvent ( 'linclear' , event . detail ) ;
154
159
} ,
155
160
}
156
161
} )
Original file line number Diff line number Diff line change 1
1
/* input/input.wxss */
2
2
3
-
4
3
.form-item {
5
4
position : relative ;
6
5
font-size : 28 rpx;
51
50
}
52
51
53
52
/* labelLayout */
54
- .form-item-top {
53
+ // .form-item-top{
55
54
// display: flex;
56
55
// flex-direction: column;
57
- }
56
+ // }
58
57
59
58
// .form-item-left{
60
59
// display: flex;
77
76
justify-content : flex-start
78
77
}
79
78
80
-
81
79
.input {
82
80
height : 100% ;
83
81
line-height : 100% ;
96
94
margin-right : 20 rpx;
97
95
}
98
96
99
-
100
97
.pls-class {
101
98
color : #9a9a9a
99
+ }
100
+
101
+ .hideLabel {
102
+ padding-left : 25 rpx;
102
103
}
Original file line number Diff line number Diff line change 4
4
style="width:{{width}}rpx">
5
5
<view class='mask' wx:if="{{disabled}}"></view>
6
6
<view class='row' hidden="{{ showRow ? '' : 'hidden' }}" style="width:{{width}}rpx;"></view>
7
- <view wx:if="{{label && !labelCustom}}" class='form-label l-label-class form-label-{{labelLayout}}' style='{{labelLayout !== "top" ? "width:"+ labelWidth+ "rpx;" : "" }} height:{{labelLayout== "top" ? labelWidth + "rpx" : "" }}'>
7
+ <view wx:if="{{label && !labelCustom}}" hidden="{{hideLabel}}" class='form-label l-label-class form-label-{{labelLayout}}' style='{{labelLayout !== "top" ? "width:"+ labelWidth+ "rpx;" : "" }} height:{{labelLayout== "top" ? labelWidth + "rpx" : "" }}'>
8
8
<text><text class='text-require' wx:if="{{required}}">* </text>{{label}}<text wx:if="{{colon}}">:</text>
9
9
</text>
10
10
</view>
11
- <view wx:else class='form-label l-label-class form-label-{{labelLayout}}' style='{{labelLayout !== "top" ? "width:"+ labelWidth+ "rpx;" : "" }} height:{{labelLayout== "top" ? labelWidth + "rpx" : "" }}'>
11
+ <view wx:else hidden="{{hideLabel}}" class='form-label l-label-class form-label-{{labelLayout}}' style='{{labelLayout !== "top" ? "width:"+ labelWidth+ "rpx;" : "" }} height:{{labelLayout== "top" ? labelWidth + "rpx" : "" }}'>
12
12
<slot name="left" />
13
13
</view>
14
14
<!-- 小程序表单组件 -->
15
15
<input
16
- class="input"
16
+ class="input {{hideLabel?'hideLabel':''}} "
17
17
value="{{ value }}"
18
18
type="{{type}}"
19
19
password="{{type==='password'}}"
You can’t perform that action at this time.
0 commit comments