Fix error of @/views/loadComponents
This commit is contained in:
parent
c0bd96be4b
commit
9792439b13
|
@ -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()
|
||||||
|
|
|
@ -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(fileName
|
camelCase(
|
||||||
.split('/')
|
fileName.replace(/^\.\/(.*)\.\w+$/, '$1')
|
||||||
.pop()
|
|
||||||
.replace(/\.\w+$/, '')
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
Vue.component(componentName, componentConfig.default || componentConfig)
|
Vue.component(componentName, componentConfig.default || componentConfig)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user