SearchPage.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <template>
  2. <div ref="main" class="main" @click="close">
  3. <div class="mainWindow" @click.stop>
  4. <Window @close="close">
  5. <template slot="header">
  6. {{ header }}
  7. </template>
  8. </Window>
  9. </div>
  10. </div>
  11. </template>
  12. <script>
  13. //-----------------------------------------------------------------------------
  14. import Vue from 'vue';
  15. import Component from 'vue-class-component';
  16. import Window from '../../share/Window.vue';
  17. export default @Component({
  18. components: {
  19. Window,
  20. },
  21. })
  22. class SearchPage extends Vue {
  23. header = null;
  24. created() {
  25. this.commit = this.$store.commit;
  26. this.reader = this.$store.state.reader;
  27. }
  28. close() {
  29. this.$emit('search-toggle');
  30. }
  31. keyHook(event) {
  32. if (event.type == 'keydown' && (event.code == 'Escape')) {
  33. this.close();
  34. }
  35. return true;
  36. }
  37. }
  38. //-----------------------------------------------------------------------------
  39. </script>
  40. <style scoped>
  41. .main {
  42. position: absolute;
  43. width: 100%;
  44. height: 100%;
  45. z-index: 40;
  46. display: flex;
  47. flex-direction: column;
  48. justify-content: flex-start;
  49. align-items: center;
  50. }
  51. .mainWindow {
  52. width: 100%;
  53. max-width: 400px;
  54. height: 140px;
  55. display: flex;
  56. }
  57. </style>