新增快捷键设置

This commit is contained in:
lyswhut
2020-06-24 01:20:56 +08:00
parent 2424c76c50
commit 9b82cdfe53
58 changed files with 2254 additions and 1450 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
<template lang="pug">
input(:class="$style.input" :type="type" :placeholder="placeholder" v-model.trim="text" :disabled="disabled"
@focus="$emit('focus', $event)" @blur="$emit('blur', $event)" @input="$emit('input', text)" @change="$emit('change', text)"
@keyup.enter="submit")
@keyup.enter="$emit('submit', text)")
</template>
<script>
@@ -24,6 +24,7 @@ div(:class="$style.container")
<script>
import { clipboardReadText } from '../../utils'
import { common as eventCommonNames } from '../../../common/hotKey'
export default {
props: {
placeholder: {
@@ -77,9 +78,21 @@ export default {
},
},
mounted() {
if (this.$store.getters.setting.search.isFocusSearchBox) this.$refs.dom_input.focus()
if (this.$store.getters.setting.search.isFocusSearchBox) this.handleFocusInput()
this.handleRegisterEvent('on')
},
beforeDestroy() {
this.handleRegisterEvent('off')
},
methods: {
handleRegisterEvent(action) {
let eventHub = window.eventHub
let name = action == 'on' ? '$on' : '$off'
eventHub[name](eventCommonNames.focusSearchInput.action, this.handleFocusInput)
},
handleFocusInput() {
this.$refs.dom_input.focus()
},
handleTemplistClick(index) {
this.sendEvent('listClick', index)
},