This commit is contained in:
muwoo
2021-06-04 17:28:48 +08:00
parent ce490acb6a
commit d9c0f5ed7b
16 changed files with 430 additions and 14525 deletions

View File

@@ -1,33 +1,34 @@
<template>
<div>
<webview style="width: 100%;height: 100vh" id="webview" :src="path"></webview>
<webview style="width: 100%;height: 100vh" id="webview" :src="path" :preload="preload"></webview>
</div>
</template>
<script>
import path from 'path';
import fs from 'fs';
import {getlocalDataFile} from '../../../common/utils';
import { remote } from 'electron';
// import process from 'child_process';
import {ipcRenderer} from 'electron';
export default {
name: "index.vue",
data() {
return {
path: `File://${this.$route.query.sourceFile}`,
preload: path.join(process.cwd(), './api/index.js')
preload: `File://${path.join(__static, './preload.js')}`
}
},
mounted() {
console.log(1111, this.$route.query)
// const webview = document.querySelector('webview')
// webview.addEventListener('dom-ready', () => {
// webview.openDevTools()
// })
const webview = document.querySelector('webview');
webview.addEventListener('dom-ready', () => {
webview.openDevTools();
webview.send('onPluginReady', this.$route.query);
webview.send('onPluginEnter', this.$route.query)
});
},
beforeRouteUpdate() {
this.path = `File://${this.$route.query.sourceFile}`
},
beforeDestroy() {
const webview = document.querySelector('webview');
webview.send('onPluginOut', this.$route.query)
}
}
</script>