新增快捷键设置
This commit is contained in:
@@ -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)
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user