Skip to content

Commit

Permalink
fix(SPA): 环境变量不生效的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
mutoe committed Nov 29, 2018
1 parent 91a9451 commit 4ef525a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions resources/spa/src/constants/app.js
Expand Up @@ -3,3 +3,7 @@ import * as envConstantParseUtil from '../utils/env-constant-type-parse'
export const ENABLE_SERVICE_WORKER = envConstantParseUtil.boolean(
process.env.VUE_APP_ENABLE_SERVICE_WORKER || false
)

export const ENABLE_MOBLINK = envConstantParseUtil.boolean(
process.env.VUE_APP_MOBLINK_ENABLE || false
)
3 changes: 2 additions & 1 deletion resources/spa/src/main.js
@@ -1,4 +1,5 @@
import { version } from '../package.json'
import { ENABLE_MOBLINK } from '@/constants/app'

import Vue from 'vue'

Expand Down Expand Up @@ -53,7 +54,7 @@ if (!window.initUrl) {
}

// 加载 moblink 用于引导打开 APP
if (process.env.VUE_APP_MOBLINK_ENABLE) {
if (ENABLE_MOBLINK) {
window.addEventListener('load', () => {
const key = process.env.VUE_APP_MOBLINK_KEY || ''
const script = document.createElement('script')
Expand Down

0 comments on commit 4ef525a

Please sign in to comment.