将文件读取到字符串并执行它
//myApp.isPacked 用来判断是否是打包,打包之后路径引入需要更改
import path from 'path'
import fs from 'fs'
this.webview.addEventListener('dom-ready', () => {
const filePath = myApp.isPacked ? path.resolve('static/js/webview/html.js') : 'static/js/webview/html.js'
const js = fs.readFileSync(filePath).toString();
this.webview.executeJavaScript(js);
})