Fix error of @/views/loadComponents

This commit is contained in:
kPherox 2019-04-09 00:38:04 +09:00
parent c0bd96be4b
commit 9792439b13
No known key found for this signature in database
GPG Key ID: C04751C2BFA2F62D
2 changed files with 19 additions and 23 deletions

View File

@ -37,7 +37,7 @@ ipcMain.on('thedesk-info', (event: Event) => {
event.returnValue = Object.assign({
productName: app.getName(),
homePage: homepage,
versions: Object.assign(pick(process.versions, ["chrome","electron","node"]), {internal: app.getVersion()}),
versions: Object.assign(pick(process.versions, ["chrome", "electron", "node"]), { internal: app.getVersion() }),
}, TheDeskInfo)
})
@ -168,7 +168,7 @@ class Application {
})
let openUrl = (event: Event, url: string) => {
if (url === process.env.WEBPACK_DEV_SERVER_URL + options.loadPath) {
if (isDevelopment && url === process.env.WEBPACK_DEV_SERVER_URL + options.loadPath) {
return
}
event.preventDefault()

View File

@ -1,7 +1,8 @@
'use strict'
import upperFirst from 'lodash/upperFirst'
import camelCase from 'lodash/camelCase'
import Vue from 'vue';
import { upperFirst } from 'lodash'
import { camelCase } from 'lodash'
const requireComponent = require.context(
'@/components',
@ -9,19 +10,14 @@ const requireComponent = require.context(
/Base[A-Z]\w+\.(vue|js)$/
)
export default function(Vue) {
requireComponent.keys().forEach(fileName => {
export default function() {
requireComponent.keys().forEach((fileName: string) => {
const componentConfig = requireComponent(fileName)
const componentName = upperFirst(
camelCase(fileName
.split('/')
.pop()
.replace(/\.\w+$/, '')
camelCase(
fileName.replace(/^\.\/(.*)\.\w+$/, '$1')
)
)
Vue.component(componentName, componentConfig.default || componentConfig)
})
})
}