mirror of
https://github.com/yuruotong1/autoMate.git
synced 2025-12-26 05:16:21 +08:00
快捷键注册
This commit is contained in:
parent
2bd63a8023
commit
13d6e00a88
@ -5,7 +5,8 @@ export const config = {
|
||||
search: {
|
||||
id: 0,
|
||||
options: {
|
||||
hash: ''
|
||||
hash: '',
|
||||
openDevTools: true,
|
||||
}
|
||||
},
|
||||
config: {
|
||||
|
||||
@ -3,7 +3,7 @@ import { useStore } from "@renderer/store/useStore"
|
||||
export default() => {
|
||||
const setError = useStore(state => state.setError)
|
||||
const register = async ()=>{
|
||||
const ret = (await window.api.sql('', 'config')) as Record<string, any>
|
||||
const ret = (await window.api.sql('', 'config')) as Record<string, string>
|
||||
const isBind = await window.api.shortCut(ret.shortCut)
|
||||
isBind || setError("注册失败")
|
||||
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
export default async ({request})=>{
|
||||
console.log("request", request)
|
||||
const formData = await request.formData()
|
||||
console.log("data:", formData)
|
||||
const data = Object.fromEntries(formData)
|
||||
|
||||
const isRegistered = await window.api.shortCut(data.shortCut)
|
||||
if (isRegistered){
|
||||
return window.api.sql(`update config set content=@content where id = 1`,
|
||||
|
||||
@ -14,7 +14,7 @@ export const Setting = () => {
|
||||
<h5>快捷键定义</h5>
|
||||
<input
|
||||
type="text"
|
||||
name="shortcut"
|
||||
name="shortCut"
|
||||
defaultValue={config.shortCut}
|
||||
readOnly
|
||||
onKeyDown={(e) => {
|
||||
@ -26,8 +26,10 @@ export const Setting = () => {
|
||||
|
||||
}}
|
||||
onKeyUp={(e) => {
|
||||
submit(e.currentTarget.form, {method: 'POST'})
|
||||
setKeys([])
|
||||
console.log("keys", e.currentTarget.value)
|
||||
submit(e.currentTarget.form, {method: 'POST'})
|
||||
|
||||
}}
|
||||
/>
|
||||
</section>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user