登录页面输入密码时 监听大写是否被锁定
This commit is contained in:
parent
f7b6f2005c
commit
a095c709f0
|
@ -35,6 +35,7 @@
|
||||||
:placeholder="$t('login.password')"
|
:placeholder="$t('login.password')"
|
||||||
name="password"
|
name="password"
|
||||||
auto-complete="on"
|
auto-complete="on"
|
||||||
|
@keyup.native="checkCapslock"
|
||||||
@keyup.enter.native="handleLogin"
|
@keyup.enter.native="handleLogin"
|
||||||
/>
|
/>
|
||||||
<span class="show-pwd" @click="showPwd">
|
<span class="show-pwd" @click="showPwd">
|
||||||
|
@ -76,6 +77,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { validUsername } from '@/utils/validate'
|
import { validUsername } from '@/utils/validate'
|
||||||
|
import { debounce } from '@/utils'
|
||||||
import LangSelect from '@/components/LangSelect'
|
import LangSelect from '@/components/LangSelect'
|
||||||
import SocialSign from './socialSignin'
|
import SocialSign from './socialSignin'
|
||||||
|
|
||||||
|
@ -134,6 +136,24 @@ export default {
|
||||||
// window.removeEventListener('storage', this.afterQRScan)
|
// window.removeEventListener('storage', this.afterQRScan)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
capslockNotify: debounce(function() {
|
||||||
|
this.$notify({
|
||||||
|
title: '提示',
|
||||||
|
message: '大写锁定已打开',
|
||||||
|
duration: 4500,
|
||||||
|
showClose: false,
|
||||||
|
type: 'warning'
|
||||||
|
})
|
||||||
|
}, 4500, true),
|
||||||
|
checkCapslock({ shiftKey, key } = {}) {
|
||||||
|
if (((key >= 'a' && key <= 'z') || (key >= 'A' && key <= 'Z')) && key.length === 1) {
|
||||||
|
if (shiftKey && (key >= 'a' && key <= 'z') || !shiftKey && (key >= 'A' && key <= 'Z')) {
|
||||||
|
this.capslockNotify()
|
||||||
|
} else {
|
||||||
|
this.$notify.closeAll()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
showPwd() {
|
showPwd() {
|
||||||
if (this.passwordType === 'password') {
|
if (this.passwordType === 'password') {
|
||||||
this.passwordType = ''
|
this.passwordType = ''
|
||||||
|
|
Loading…
Reference in New Issue