Refactor
This commit is contained in:
parent
929cc14761
commit
aec1c1312e
|
|
@ -1,6 +1,12 @@
|
|||
import elementLocale from 'element-ui/lib/locale'
|
||||
import { locale as elementLocale } from 'element-ui'
|
||||
import { emit } from './event'
|
||||
|
||||
declare module 'element-ui/types/element-ui' {
|
||||
export const locale: {
|
||||
use(i18n: any): void
|
||||
}
|
||||
}
|
||||
|
||||
const langs = {
|
||||
en: {
|
||||
bs: () => import('../../../lang/en/front-end.yml'),
|
||||
|
|
@ -12,7 +18,7 @@ const langs = {
|
|||
},
|
||||
}
|
||||
|
||||
async function load(language) {
|
||||
async function load(language: import('../shims').I18n) {
|
||||
const { bs: loadBS, element: loadElement } = langs[language]
|
||||
await Promise.all([
|
||||
(async () => {
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
/* eslint-disable no-undef */
|
||||
/* eslint-disable prefer-const */
|
||||
/* eslint-disable camelcase */
|
||||
declare let __webpack_public_path__: string
|
||||
__webpack_public_path__ = process.env.NODE_ENV === 'development'
|
||||
? 'http://127.0.0.1:8080/'
|
||||
: `${blessing.base_url}/app/`
|
||||
6
resources/assets/src/shims.d.ts
vendored
6
resources/assets/src/shims.d.ts
vendored
|
|
@ -2,13 +2,15 @@
|
|||
import Vue from 'vue'
|
||||
import * as JQuery from 'jquery'
|
||||
|
||||
type I18n = 'en' | 'zh_CN'
|
||||
|
||||
declare global {
|
||||
let blessing: {
|
||||
base_url: string
|
||||
debug: boolean
|
||||
env: string
|
||||
fallback_locale: string
|
||||
locale: string
|
||||
fallback_locale: I18n
|
||||
locale: I18n
|
||||
site_name: string
|
||||
timezone: string
|
||||
version: string
|
||||
|
|
|
|||
|
|
@ -8,3 +8,11 @@ declare module '*.vue' {
|
|||
declare module '*.styl' {
|
||||
export default {}
|
||||
}
|
||||
|
||||
declare module '*.yml' {
|
||||
export default {}
|
||||
}
|
||||
|
||||
declare module 'element-ui/lib/locale/lang/*' {
|
||||
export default {}
|
||||
}
|
||||
|
|
@ -46,7 +46,12 @@ const config = {
|
|||
libraryName: 'element-ui',
|
||||
libraryDirectory: 'lib',
|
||||
camel2DashComponentName: true,
|
||||
style: name => `${name.replace('lib/', 'lib/theme-chalk/')}.css`,
|
||||
style: name => {
|
||||
if (name.includes('locale')) {
|
||||
return false
|
||||
}
|
||||
return `${name.replace('lib/', 'lib/theme-chalk/')}.css`
|
||||
},
|
||||
}],
|
||||
],
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user