ADD myConfig 业务配置

This commit is contained in:
sc 2022-06-16 08:44:32 +08:00
parent 98ad9c484b
commit d4b44c042d
3 changed files with 21 additions and 5 deletions

View File

@ -67,10 +67,14 @@ const DEFAULT_CONFIG = {
} }
} }
//合并业务配置
import MY_CONFIG from "./myConfig"
Object.assign(DEFAULT_CONFIG, MY_CONFIG)
// 如果生产模式就合并动态的APP_CONFIG // 如果生产模式就合并动态的APP_CONFIG
// public/config.js // public/config.js
if(process.env.NODE_ENV === 'production'){ if(process.env.NODE_ENV === 'production'){
Object.assign(DEFAULT_CONFIG, APP_CONFIG) Object.assign(DEFAULT_CONFIG, APP_CONFIG)
} }
module.exports = DEFAULT_CONFIG export default DEFAULT_CONFIG

10
src/config/myConfig.js Normal file
View File

@ -0,0 +1,10 @@
//业务配置
//会合并至this.$CONFIG
//生产模式 public/config.js 同名key会覆盖这里的配置从而实现打包后的热更新
//为避免和SCUI框架配置混淆建议添加前缀 MY_
//全局可使用 this.$CONFIG.MY_KEY 访问
export default {
//是否显示第三方授权登录
MY_SHOW_LOGIN_OAUTH: true
}

View File

@ -51,10 +51,12 @@
<phone-form></phone-form> <phone-form></phone-form>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
<template v-if="$CONFIG.MY_SHOW_LOGIN_OAUTH">
<el-divider>{{ $t('login.signInOther') }}</el-divider> <el-divider>{{ $t('login.signInOther') }}</el-divider>
<div class="login-oauth"> <div class="login-oauth">
<el-button type="success" icon="sc-icon-wechat" circle @click="wechatLogin"></el-button> <el-button type="success" icon="sc-icon-wechat" circle @click="wechatLogin"></el-button>
</div> </div>
</template>
</div> </div>
</div> </div>
</div> </div>