refs #3784 Close Login and Authorize window with esc
This commit is contained in:
parent
0c4b49cc1d
commit
7b2dfa96cf
|
@ -54,6 +54,7 @@ import { defineComponent, ref, reactive, toRefs, onMounted } from 'vue'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import { useI18next } from 'vue3-i18next'
|
import { useI18next } from 'vue3-i18next'
|
||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage } from 'element-plus'
|
||||||
|
import { useMagicKeys, whenever } from '@vueuse/core'
|
||||||
import { useStore } from '@/store'
|
import { useStore } from '@/store'
|
||||||
import { ACTION_TYPES } from '@/store/Authorize'
|
import { ACTION_TYPES } from '@/store/Authorize'
|
||||||
|
|
||||||
|
@ -74,6 +75,7 @@ export default defineComponent({
|
||||||
const store = useStore()
|
const store = useStore()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const i18n = useI18next()
|
const i18n = useI18next()
|
||||||
|
const { escape } = useMagicKeys()
|
||||||
|
|
||||||
const { url, sns } = toRefs(props)
|
const { url, sns } = toRefs(props)
|
||||||
|
|
||||||
|
@ -86,6 +88,10 @@ export default defineComponent({
|
||||||
console.log(url.value)
|
console.log(url.value)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
whenever(escape, () => {
|
||||||
|
close()
|
||||||
|
})
|
||||||
|
|
||||||
const authorizeSubmit = () => {
|
const authorizeSubmit = () => {
|
||||||
submitting.value = true
|
submitting.value = true
|
||||||
store
|
store
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
import { defineComponent } from 'vue'
|
import { defineComponent } from 'vue'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import { useStore } from '@/store'
|
import { useStore } from '@/store'
|
||||||
|
import { useMagicKeys, whenever } from '@vueuse/core'
|
||||||
import LoginForm from './Login/LoginForm.vue'
|
import LoginForm from './Login/LoginForm.vue'
|
||||||
import { ACTION_TYPES } from '@/store/Login'
|
import { ACTION_TYPES } from '@/store/Login'
|
||||||
|
|
||||||
|
@ -30,6 +31,11 @@ export default defineComponent({
|
||||||
const space = 'Login'
|
const space = 'Login'
|
||||||
const store = useStore()
|
const store = useStore()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
const { escape } = useMagicKeys()
|
||||||
|
|
||||||
|
whenever(escape, () => {
|
||||||
|
close()
|
||||||
|
})
|
||||||
|
|
||||||
const close = () => {
|
const close = () => {
|
||||||
store.dispatch(`${space}/${ACTION_TYPES.PAGE_BACK}`)
|
store.dispatch(`${space}/${ACTION_TYPES.PAGE_BACK}`)
|
||||||
|
|
Loading…
Reference in New Issue