mirror of
https://github.com/electron-vite/electron-vite-vue
synced 2025-01-19 20:07:06 +08:00
chore(docs): update
This commit is contained in:
parent
fc93d313fa
commit
b6927955fa
11
README.md
11
README.md
@ -70,9 +70,20 @@ Once `dev` or `build` npm-script executed will be generate named `dist` folder.
|
|||||||
contextBridge.exposeInMainWorld('ipcRenderer', ipcRenderer)
|
contextBridge.exposeInMainWorld('ipcRenderer', ipcRenderer)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
* **src/renderer/src/global.d.ts**
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// Defined on the window
|
||||||
|
interface Window {
|
||||||
|
fs: typeof import('fs')
|
||||||
|
ipcRenderer: import('electron').IpcRenderer
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
* **src/renderer/src/main.ts**
|
* **src/renderer/src/main.ts**
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
|
// Use Electron, NodeJs API in Renderer-process
|
||||||
console.log('fs', window.fs)
|
console.log('fs', window.fs)
|
||||||
console.log('ipcRenderer', window.ipcRenderer)
|
console.log('ipcRenderer', window.ipcRenderer)
|
||||||
```
|
```
|
||||||
|
@ -71,9 +71,20 @@
|
|||||||
contextBridge.exposeInMainWorld('ipcRenderer', ipcRenderer)
|
contextBridge.exposeInMainWorld('ipcRenderer', ipcRenderer)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
* **src/renderer/src/global.d.ts**
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// Defined on the window
|
||||||
|
interface Window {
|
||||||
|
fs: typeof import('fs')
|
||||||
|
ipcRenderer: import('electron').IpcRenderer
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
* **src/renderer/main.ts**
|
* **src/renderer/main.ts**
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
|
// Use Electron, NodeJs API in Renderer-process
|
||||||
console.log('fs', window.fs)
|
console.log('fs', window.fs)
|
||||||
console.log('ipcRenderer', window.ipcRenderer)
|
console.log('ipcRenderer', window.ipcRenderer)
|
||||||
```
|
```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user