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

@ -34,10 +34,10 @@ export type TheDeskInfoObject = typeof TheDeskInfo;
declare const __static: string; declare const __static: string;
ipcMain.on('thedesk-info', (event: Event) => { ipcMain.on('thedesk-info', (event: Event) => {
event.returnValue = Object.assign({ event.returnValue = Object.assign({
productName: app.getName(), productName: app.getName(),
homePage: homepage, 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) }, TheDeskInfo)
}) })
@ -168,7 +168,7 @@ class Application {
}) })
let openUrl = (event: Event, url: string) => { 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 return
} }
event.preventDefault() event.preventDefault()
@ -300,9 +300,9 @@ class ApplicationMenu {
{ type: 'separator' }, { type: 'separator' },
{ role: 'front' }, { role: 'front' },
] : [ ] : [
{ role: 'minimize' }, { role: 'minimize' },
{ role: 'close' }, { role: 'close' },
] ]
return { return {
label: 'Window', label: 'Window',
submenu: windowMenu, submenu: windowMenu,

View File

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