mirror of
https://github.com/rubickCenter/rubick
synced 2025-12-25 03:49:26 +08:00
✨ API 部分迁移完成
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { watch, ref, nextTick, toRaw } from "vue";
|
||||
import { ipcRenderer } from "electron";
|
||||
import { ipcRenderer, remote } from "electron";
|
||||
import Result from "./components/result.vue";
|
||||
import Search from "./components/search.vue";
|
||||
import getWindowHeight from "../common/utils/getWindowHeight";
|
||||
@@ -51,6 +51,7 @@ getPluginInfo({
|
||||
pluginPath: `${__static}/feature/package.json`,
|
||||
}).then((res) => {
|
||||
menuPluginInfo.value = res;
|
||||
remote.getGlobal("LOCAL_PLUGINS").addPlugin(res);
|
||||
});
|
||||
|
||||
watch([searchValue], () => {
|
||||
|
||||
@@ -80,6 +80,10 @@ const createPluginManager = (): any => {
|
||||
const removePlugin = (plugin: any) => {
|
||||
// todo
|
||||
};
|
||||
window.updatePlugin = ({ currentPlugin }: any) => {
|
||||
state.currentPlugin = currentPlugin;
|
||||
remote.getGlobal("LOCAL_PLUGINS").updatePlugin(currentPlugin);
|
||||
};
|
||||
|
||||
return {
|
||||
...toRefs(state),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { reactive, toRefs } from "vue";
|
||||
import {ipcRenderer} from "electron";
|
||||
import { ipcRenderer, remote } from "electron";
|
||||
|
||||
const searchManager = () => {
|
||||
const state = reactive({
|
||||
@@ -24,6 +24,12 @@ const searchManager = () => {
|
||||
window.setSubInput = ({ placeholder }: { placeholder: string }) => {
|
||||
state.placeholder = placeholder;
|
||||
};
|
||||
window.removeSubInput = () => {
|
||||
state.placeholder = "";
|
||||
};
|
||||
window.setSubInputValue = ({ value }: { value: string }) => {
|
||||
state.searchValue = value;
|
||||
};
|
||||
|
||||
return {
|
||||
...toRefs(state),
|
||||
|
||||
3
src/renderer/shims-vue.d.ts
vendored
3
src/renderer/shims-vue.d.ts
vendored
@@ -15,4 +15,7 @@ declare module 'lodash.throttle'
|
||||
|
||||
interface Window {
|
||||
setSubInput: ({ placeholder }: { placeholder: string }) => void;
|
||||
setSubInputValue: ({ value }: { value: string }) => void;
|
||||
removeSubInput: () => void;
|
||||
updatePlugin: (plugin: any) => void;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user