this.environment

您可以通过this.environment访问当前环境对象,它返回一个引用当前环境配置的字符串。

例如

如果网站在测试环境中运行,以下示例将显示横幅:

  1. {% if this.environment == 'test' %}
  2. <div class="banner">Test Environment</div>
  3. {% endif %}