<template>
<div class="login-container">
<el-input
v-model="pwd"
:type="type"
class="pwd-input"
placeholder="请输入密码"
>
<i
slot="suffix"
class="icon-style"
:class="elIcon"
autocomplete="auto"
@click="flag = !flag"
/>
</el-input>
</div>
</template>
<script>
export default {
data() {
return {
flag: false
};
},
computed: {
type() {
return this.flag ? "text" : "password";
},
elIcon() {
return this.flag ? "el-icon-minus" : "el-icon-view";
}
}
};
</script>
<style>
.icon-style {
margin-top: 8px;
font-size: 18px;
}
.pwd-input {
border: 1px solid #fff;
width: 250px;
}
</style>