taro中如何定义全局变量

打开 config/dev.js (橙色为全局变量)

module.exports = {
  env: {
    NODE_ENV: '"development"',
  },
  defineConstants: {
    BASE_URL: JSON.stringify('https://****.com/api'),
    IMG_URL: JSON.stringify('https://****.com/url') 
}, mini: {}, h5: {} }

  

原文地址:https://www.cnblogs.com/gqx-html/p/12552989.html