Vue vue-password-strength
by kabanoki
HTML
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/zxcvbn.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue-password-strength-meter.min.js"></script>
<div id="app">
<password
v-model="password"
:toggle="true"
@score="showScore"
@feedback="showFeedback"></password>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.6.10/vue.min.js"></script>
CSS
body {
background: #20262E;
padding: 20px;
font-family: Helvetica;
}
#app {
background: #fff;
border-radius: 4px;
padding: 20px;
transition: all 0.2s;
}
p {
text-align:cente;
}
Vue
Vue.component('password', Password);
new Vue({
el: '#app',
data: {
password: null
},
methods: {
showFeedback ({suggestions, warning}) {
console.log('🙏', suggestions)
console.log('âš ', warning)
},
showScore (score) {
console.log('đź’Ż', score)
}
}
})