📌  相关文章
📜  反应动态设置 - Javascript代码示例

📅  最后修改于: 2022-03-11 15:01:28.380000             🧑  作者: Mango

代码示例1
The easiest solution for me turned out to be to include a tag in my index.html. This gets minified during the NPM build but it does not get bundled with the other javascript so it can easily be replaced with another file at deploy time. My config.js looks like this:

config = {
    "title": "Application Title",
    "envName": "LocalDev",
    "URL": "localhost:8090"
}
Then inside my react components they're accessible by using:

const config = window.config;
alert("Application branding title is: " + config.title);