After upgrade from 0.28 it is impossible to change input field type back to text
after changing from text
to password
: field remains password
<template>
<div>
<input
v-model="val"
v-bind:type=" visible ? 'text' : 'password' "
style="width: 400px; height: 100px"
/>
<div
v-on:click="visible = !visible"
class="button"
>
<text>Toggle to {{ visible ? 'password' : 'text' }}</text>
</div>
</div>
</template>
<script>
export default {
name: 'PasswordField',
data () {
return {
visible: true,
val: 'Pazzword'
};
},
};
</script>
1条答案
按热度按时间2w3kk1z51#
改为v-bind:type=" visible ? '' : 'password' "即可