<template>
<div class="login-page" style="height: 100%">
<el-form-item prop="password">
<el-tooltip v-model="upperTooltip" content="已开启大写" placement="top" manual>
<el-input
type="password"
v-model.trim="loginForm.password"
class="pwd"
ref="password"
placeholder="请输入密码"
prefix-icon="el-icon-lock"
show-password
@keyup.native="checkCapslock"
@blur="capsTooltip = false"
@keyup.enter.native="enterProjectList"
></el-input>
</el-tooltip>
</el-form-item>
</div>
</template>
<script>
export default {
name: 'Login',
data() {
return {
upperTooltip: true
}
},
methods: {
checkCapslock({ shiftKey, key } = {}) {
if (key && key.length === 1) {
if (
(shiftKey && key >= 'a' && key <= 'z') ||
(!shiftKey && key >= 'A' && key <= 'Z')
) {
this.upperTooltip = true
} else {
this.upperTooltip = false
}
}
if (key === 'CapsLock' && this.upperTooltip === true) {
this.upperTooltip = false
}
}
}
}
</script>
<style lang="scss" scoped>
</style>
vue(大写提示功能)
于 2023-06-16 10:48:13 首次发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)