Vue
by nkovacs
HTML
<div id="app">
<ol class="numbered" type="1">
<li>Click show to show the input field</li>
<li>Click the input field</li>
<li>Both Chrome and Firefox will offer to generate a password, accept it</li>
<li>Click ok</li>
<li>Click show again to show the input field</li>
<li>Click the input field</li>
<li>Chrome will not offer to generate a password; Firefox will generate the same password</li>
</ol>
<button type="button" @click="show()">
Show
</button>
<div v-if="shown">
<input type="password" autocomplete="new-password" v-model="pass" />
<button type="button" @click="confirm">
ok
</button>
</div>
<button type="button" @click="show2()">
Show
</button>
<div v-if="shown2">
<input type="password" autocomplete="new-password" v-model="pass2" />
<button type="button" @click="confirm2">
ok
</button>
</div>
</div>
CSS
body {
background: #20262E;
padding: 20px;
font-family: Helvetica;
}
#app {
background: #fff;
border-radius: 4px;
padding: 20px;
transition: all 0.2s;
}
li {
margin: 8px 0;
}
h2 {
font-weight: bold;
margin-bottom: 15px;
}
del {
color: rgba(0, 0, 0, 0.3);
}
ol.numbered {
margin-left: 1em;
list-style: decimal;
}
Vue
new Vue({
el: "#app",
data: {
shown: false,
pass: "",
shown2: false,
pass2: "",
},
methods: {
show: function() {
this.shown = true
},
confirm: function() {
this.pass = ""
this.shown = false
},
show2: function() {
this.shown2 = true
},
confirm2: function() {
this.pass2 = ""
this.shown2 = false
},
}
})