2018-08-28 09:58:31 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<div class="panel-search">
|
2018-08-28 13:19:50 +08:00
|
|
|
|
<div class="panel-search__input-group" flex="dir:top main:center cross:center">
|
2018-08-28 09:58:31 +08:00
|
|
|
|
<el-input
|
|
|
|
|
|
class="panel-search__input"
|
|
|
|
|
|
ref="input"
|
|
|
|
|
|
v-model="input"
|
|
|
|
|
|
suffix-icon="el-icon-search"
|
2018-08-28 11:12:51 +08:00
|
|
|
|
placeholder="搜索页面"
|
|
|
|
|
|
@keydown.esc.native="handleEsc"/>
|
2018-08-28 13:19:50 +08:00
|
|
|
|
<div class="panel-search__tip">
|
|
|
|
|
|
您可以使用快捷键
|
|
|
|
|
|
<span class="panel-search__key">
|
|
|
|
|
|
{{hotkey.open}}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
唤醒搜索面板,按
|
|
|
|
|
|
<span class="panel-search__key">
|
|
|
|
|
|
{{hotkey.close}}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
关闭
|
|
|
|
|
|
</div>
|
2018-08-28 09:58:31 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
2018-08-28 13:19:50 +08:00
|
|
|
|
import { mapState } from 'vuex'
|
2018-08-28 09:58:31 +08:00
|
|
|
|
export default {
|
|
|
|
|
|
data () {
|
|
|
|
|
|
return {
|
|
|
|
|
|
input: ''
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2018-08-28 13:19:50 +08:00
|
|
|
|
computed: {
|
|
|
|
|
|
...mapState('d2admin/search', [
|
|
|
|
|
|
'hotkey'
|
|
|
|
|
|
])
|
|
|
|
|
|
},
|
2018-08-28 09:58:31 +08:00
|
|
|
|
methods: {
|
|
|
|
|
|
focus () {
|
|
|
|
|
|
this.$nextTick(() => {
|
2018-08-28 11:12:51 +08:00
|
|
|
|
this.input = ''
|
2018-08-28 09:58:31 +08:00
|
|
|
|
this.$refs.input.focus()
|
|
|
|
|
|
})
|
2018-08-28 11:12:51 +08:00
|
|
|
|
},
|
|
|
|
|
|
handleEsc () {
|
|
|
|
|
|
this.$emit('close')
|
2018-08-28 09:58:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2018-08-28 13:19:50 +08:00
|
|
|
|
@import '~@/assets/style/public.scss';
|
2018-08-28 09:58:31 +08:00
|
|
|
|
.panel-search {
|
|
|
|
|
|
margin: 20px;
|
|
|
|
|
|
.panel-search__input-group {
|
|
|
|
|
|
height: 200px;
|
|
|
|
|
|
.panel-search__input {
|
|
|
|
|
|
width: 300px;
|
|
|
|
|
|
}
|
2018-08-28 13:19:50 +08:00
|
|
|
|
.panel-search__tip {
|
|
|
|
|
|
@extend %unable-select;
|
|
|
|
|
|
margin-top: 20px;
|
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
|
color: $color-text-sub;
|
|
|
|
|
|
.panel-search__key {
|
|
|
|
|
|
padding: 1px 5px;
|
|
|
|
|
|
margin: 0px 2px;
|
|
|
|
|
|
border-radius: 2px;
|
|
|
|
|
|
background-color: $color-text-normal;
|
|
|
|
|
|
color: $color-bg;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-08-28 09:58:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|