vue-element-admin
After 4.0 based on vue-cli
to build, so all are based on an environment variable configuration vue-cli
to implement and control.
Official Documents
.env # 在所有的环境中被载入
.env.[mode] # 只在指定的模式中被载入
An environment file contains only environment variables "key = value" pairs:
FOO=bar
VUE_APP_SECRET=secret
note! ! !
Environment variables must be VUE_APP_
to begin with. Such VUE_APP_API
as: ,VUE_APP_TITLE
You can get the code by:
console.log(process.env.VUE_APP_xxxx)
In addition to VUE_APP_*
outside variables in your application code always available there are two special variables:
NODE_ENV
- will be the "development", "production" or "test" one. Value depends on the operating mode of the application.BASE_URL
- and will bevue.config.js
in thepublicPath
options match, that your application will be deployed to the base path.
# Build-related
Except for some written in the .env
outside environment variable, and some build and deploy relevant variables are required in the vue.config.js
configuration.
You can process.env.NODE_ENV
be performed to determine the environment, to set different parameters.
Specific code can learn vue.config.js
http://www.kemaisii.cn
http://www.eternelle.cn
http://www.yajuxuan.cn
http://www.nodonkg.cn
http://www.yurunyipinn.cn
http://www.niudangjiaa.cn
http://www.feikeshoubiaoo.cn
http://www.yumengse.cn
http://www.parniss.cn
http://www.sensefadd.cn
http://www.youmaqi.cn
http://www.yinghengg.cn
http://www.xizuann.cn
http://www.vapsint.cn
http://www.moshii.cn
http://www.shamandaweiyu.cn
http://www.taiguangyinlou.cn