0
Follow
0
View

process.env.VUE_APP_ISSWAPP: undefined

roz0803 注册会员
2023-02-27 20:17

the reference answer GPT ᴼ ᴾ ᴱ ᴺ ᴬ ᴵ < br / > process. The env. VUE_APP_ISSWAPP by Vue CLI Provides the environment variable function to set and get.

If the value is undefined, you can check the following aspects:

1. Check whether the.env file or other environment variable files(such as.env.local,.env.development,.env.production, etc.) exist in the root directory of the project, and whether the VUE_APP_ISSWAPP variable is set in the file. For example:

VUE_APP_ISSWAPP=true


If the variable is not set, or the value of the variable is undefined, then the value obtained in the code will be undefined.

2. Ensure that the process object has been introduced where the variable is used. In Vue single-file components, you can import by importing process from 'process'. In normal JavaScript files, you need to install the process module and then import it by require('process') or import process from 'process'.

If process is not introduced, the value obtained will also be undefined.

3. Make sure that where the variable is fetched, it is executed after the Vue instance is created. The value of process.env.VUE_APP_ISSWAPP may not have been correctly assigned before the Vue instance was created.

This variable can be obtained in the mounted() method of the Vue lifecycle, for example:

export default {
  mounted() {
    console.log(process.env.VUE_APP_ISSWAPP);
  }
}


If you need to get the variable before the Vue instance is created, you can use other means, such as getting the variable value from the server through an AJAX request.

About the Author

Question Info

Publish Time
2023-02-27 20:17
Update Time
2023-02-27 20:17

Related Question

严重: Error deploying web application directory

使用Dapper Plus BulkInsert处理错误

c++ Code::Blocks ios::in works, ios::out | ios::app not

制作影视APP的视频文件要压缩吗?

如何从文件夹显示所有图像到web(flask web app)

uniapp如何拼接图片地址

无法读取undefined的属性(读取'navigationStart')

多表查询,mapper.xml

安卓app里实现的点按钮打开网页,在安卓12上运行,网址不完整了!为什么呢?

uniapp Map组件 标记点列表联动