File tree Expand file tree Collapse file tree 2 files changed +26
-11
lines changed Expand file tree Collapse file tree 2 files changed +26
-11
lines changed Original file line number Diff line number Diff line change @@ -91,6 +91,7 @@ Interactive password strength meter based on [zxcvbn](https://github.com/dropbox
91
91
| strengthMeterClass | String | Password__ strength-meter | strength-meter class |
92
92
| strengthMeterFillClass | String | Password__ strength-meter--fill | strength-meter class for individual data fills |
93
93
| showStrengthMeter | Boolean | true | Hide the Strength Meter if you want to implement your own |
94
+ | strengthMeterOnly | Boolean | false | Hides the built-in input if you want to implement your own |
94
95
95
96
## Events
96
97
Original file line number Diff line number Diff line change 1
1
<template >
2
2
<div class =" Password" >
3
- <div class =" Password__group" >
3
+ <div
4
+ v-if =" !strengthMeterOnly"
5
+ class =" Password__group"
6
+ >
4
7
<input
5
8
:type =" inputType"
6
9
:ref =" referanceValue"
7
- v-bind:value =" value"
8
- v-on:input =" emitValue($event.target.value)"
9
10
:class =" [defaultClass, disabled ? disabledClass : '']"
10
11
:name =" name"
11
12
:id =" id"
12
13
:placeholder =" placeholder"
13
14
:required =" required"
14
15
:disabled =" disabled"
16
+ v-bind:value =" value"
17
+ @input =" evt => emitValue(evt.target.value)"
15
18
>
16
19
<div class =" Password__icons" >
17
20
<div
157
160
type: Boolean ,
158
161
default: true
159
162
},
163
+ /**
164
+ * Prop to toggle the
165
+ * input element if
166
+ * User wants to implement
167
+ * their own input element
168
+ */
169
+ strengthMeterOnly: {
170
+ type: Boolean ,
171
+ default: false
172
+ },
160
173
/**
161
174
* CSS Class for the Input field
162
175
* @type {String}
222
235
},
223
236
224
237
methods: {
225
- /**
226
- * Emit passowrd value to parent component
227
- * @param {String} value password typed in
228
- */
229
- emitValue (value ) {
230
- this .password = value
231
- this .$emit (' input' , value)
232
- },
233
238
togglePassword () {
234
239
if (this .$data ._showPassword ) {
235
240
this .$emit (' hide' )
238
243
this .$emit (' show' )
239
244
this .$data ._showPassword = true
240
245
}
246
+ },
247
+ emitValue (value ) {
248
+ this .$emit (' input' , value)
249
+ this .password = value
241
250
}
242
251
},
243
252
290
299
},
291
300
292
301
watch: {
302
+ value (newValue ) {
303
+ if (this .strengthMeterOnly ) {
304
+ this .emitValue (newValue)
305
+ }
306
+ },
293
307
passwordStrength (score ) {
294
308
this .$emit (' score' , score)
295
309
this .$emit (' feedback' , zxcvbn (this .password ).feedback )
You can’t perform that action at this time.
0 commit comments