修复开发模式下页面无法刷新的问题

pull/225/head
lyswhut 2020-03-31 15:46:19 +08:00
parent 25ae72cd26
commit ef50d90a18
2 changed files with 4 additions and 2 deletions

View File

@ -15,8 +15,11 @@ app.on('second-instance', (event, argv, cwd) => {
} }
}) })
const isDev = process.env.NODE_ENV !== 'production'
app.on('web-contents-created', (event, contents) => { app.on('web-contents-created', (event, contents) => {
contents.on('will-navigate', (event, navigationUrl) => { contents.on('will-navigate', (event, navigationUrl) => {
if (isDev) return console.log('navigation to url:', navigationUrl)
event.preventDefault() event.preventDefault()
}) })
contents.on('new-window', async(event, navigationUrl) => { contents.on('new-window', async(event, navigationUrl) => {
@ -27,7 +30,6 @@ app.on('web-contents-created', (event, contents) => {
}) })
}) })
const isDev = process.env.NODE_ENV !== 'production'
// https://github.com/electron/electron/issues/18397 // https://github.com/electron/electron/issues/18397
app.allowRendererProcessReuse = !isDev app.allowRendererProcessReuse = !isDev

View File

@ -2,7 +2,7 @@ import { httpFetch } from '../../request'
export default { export default {
getLyric(songInfo, tryNum = 0) { getLyric(songInfo, tryNum = 0) {
console.log(songInfo.copyrightId) // console.log(songInfo.copyrightId)
if (songInfo.lrcUrl) { if (songInfo.lrcUrl) {
let requestObj = httpFetch(songInfo.lrcUrl) let requestObj = httpFetch(songInfo.lrcUrl)
requestObj.promise = requestObj.promise.then(({ body, statusCode }) => { requestObj.promise = requestObj.promise.then(({ body, statusCode }) => {