4
4
v-model =" value"
5
5
:color =" textFieldColor"
6
6
:type =" show ? 'text' : 'password'"
7
+ :hint =" hint"
7
8
:label =" label"
8
9
background-color =" white"
9
10
class =" elevation-0"
27
28
v-model =" value"
28
29
:color =" textFieldColor"
29
30
type =" text"
31
+ :hint =" hint"
30
32
:label =" label"
31
33
background-color =" white"
32
34
class =" elevation-0"
43
45
v-model =" value"
44
46
:color =" textFieldColor"
45
47
type =" text"
48
+ :hint =" hint"
46
49
:label =" label"
47
50
background-color =" white"
48
51
class =" elevation-0"
59
62
v-model =" value"
60
63
:color =" textFieldColor"
61
64
type =" text"
65
+ :hint =" hint"
62
66
:label =" label"
63
67
background-color =" white"
64
68
class =" elevation-0"
@@ -115,11 +119,16 @@ export default Vue.extend({
115
119
},
116
120
computed: {
117
121
prependIconColor(): string {
122
+ const classIdPattern = / ^ [あ-ん ] {6} $ /
118
123
if (this .type === ' classId' ) {
119
- if (! this .value || this .value . length !== 6 ) return ' #C01B61'
124
+ if (! this .value || ! classIdPattern . test ( this .value ) ) return ' #C01B61'
120
125
}
121
126
if (this .type === ' email' ) {
122
- if (! this .value || ! this .value .match (/ . + @. + \. . + / )) return ' #C01B61'
127
+ if (
128
+ ! this .value ||
129
+ ! this .value .match (/ ^ \w + ([-+. ] \w + )* @\w + ([-. ] \w + )* \. \w + ([-. ] \w + )* $ / )
130
+ )
131
+ return ' #C01B61'
123
132
}
124
133
if (this .require ) {
125
134
if (! this .value ) return ' #C01B61'
@@ -130,23 +139,33 @@ export default Vue.extend({
130
139
return ' #BDBDBD'
131
140
},
132
141
textFieldColor(): string {
142
+ const classIdPattern = / ^ [あ-ん ] {6} $ /
133
143
if (this .type === ' classId' ) {
134
- if (! this .value || this .value . length !== 6 ) return ' #C01B61'
144
+ if (! this .value || ! classIdPattern . test ( this .value ) ) return ' #C01B61'
135
145
}
136
146
if (this .type === ' email' ) {
137
- if (! this .value || ! this .value .match (/ . + @. + \. . + / )) return ' #C01B61'
147
+ if (
148
+ ! this .value ||
149
+ ! this .value .match (/ ^ \w + ([-+. ] \w + )* @\w + ([-. ] \w + )* \. \w + ([-. ] \w + )* $ / )
150
+ )
151
+ return ' #C01B61'
138
152
}
139
153
if (this .require ) {
140
154
if (! this .value ) return ' #C01B61'
141
155
}
142
156
return ' #0071C2'
143
157
},
144
158
prependIcon(): string {
159
+ const classIdPattern = / ^ [あ-ん ] {6} $ /
145
160
if (this .type === ' classId' ) {
146
- if (! this .value || this .value .length !== 6 ) return ' mdi-alert-circle'
161
+ if (! this .value || ! classIdPattern .test (this .value ))
162
+ return ' mdi-alert-circle'
147
163
}
148
164
if (this .type === ' email' ) {
149
- if (! this .value || ! this .value .match (/ . + @. + \. . + / ))
165
+ if (
166
+ ! this .value ||
167
+ ! this .value .match (/ ^ \w + ([-+. ] \w + )* @\w + ([-. ] \w + )* \. \w + ([-. ] \w + )* $ / )
168
+ )
150
169
return ' mdi-alert-circle'
151
170
}
152
171
if (this .require ) {
0 commit comments