Shortcut.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <template>
  2. <div>
  3. <h3 :style="{ marginBottom: '16px' }">
  4. demo4 快捷键
  5. </h3>
  6. <a-row :gutter="[16,16]">
  7. <a-col :span="12">
  8. 显示窗口
  9. <!-- <HotkeyInput
  10. :hotkey.sync="hotKeyObj.keys"
  11. :verify="handleHotkeyVerify"
  12. placeholder="请按需要绑定的按键,支持组合按键"
  13. /> -->
  14. <a-input-search
  15. style="width: 272px;"
  16. v-model="cmd"
  17. @search="handleSetting"
  18. placeholder="快捷键">
  19. <a-button slot="enterButton">
  20. 保存
  21. </a-button>
  22. </a-input-search>
  23. </a-col>
  24. <a-col :span="12">
  25. 隐藏窗口
  26. <a-input-search
  27. style="width: 272px;"
  28. v-model="cmd"
  29. @search="handleSetting"
  30. placeholder="快捷键">
  31. <a-button slot="enterButton">
  32. 保存
  33. </a-button>
  34. </a-input-search>
  35. </a-col>
  36. </a-row>
  37. <a-row :gutter="[16,16]">
  38. <a-col :span="12">
  39. 窗口最小化
  40. <a-input-search
  41. style="width: 272px;"
  42. v-model="cmd"
  43. @search="handleSetting"
  44. placeholder="快捷键">
  45. <a-button slot="enterButton">
  46. 保存
  47. </a-button>
  48. </a-input-search>
  49. </a-col>
  50. <a-col :span="12">
  51. 窗口还原
  52. <a-input-search
  53. style="width: 272px;"
  54. v-model="cmd"
  55. @search="handleSetting"
  56. placeholder="快捷键">
  57. <a-button slot="enterButton">
  58. 保存
  59. </a-button>
  60. </a-input-search>
  61. </a-col>
  62. </a-row>
  63. </div>
  64. </template>
  65. <script>
  66. // import VHotkey from "v-hotkey";
  67. // import { openDir } from '@/api/main'
  68. export default {
  69. components: {},
  70. data() {
  71. return {
  72. cmd: '',
  73. hotKeyObj: {
  74. tab: 'save',
  75. // keys: undefined
  76. keys: ["Ctrl+A", "Alt+D"]
  77. },
  78. };
  79. },
  80. methods: {
  81. handleSetting (value) {
  82. console.log('cmd:', value)
  83. //this.cmd = ''
  84. },
  85. handleHotkeyVerify(hotkey) {
  86. console.log('验证:', hotkey, this.hotKeyObj)
  87. return true;
  88. },
  89. }
  90. };
  91. </script>
  92. <style></style>