Fix error of @/views/loadComponents
This commit is contained in:
parent
c0bd96be4b
commit
9792439b13
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user