代码之家  ›  专栏  ›  技术社区  ›  Jaydeep rlib

在ExtJs中支持单个构建下的多个主题

  •  0
  • Jaydeep rlib  · 技术社区  · 7 年前

    "builds": {
         "classic": {
            "toolkit": "classic",
            "theme": "theme-classic"
        },
        "triton": {
            "toolkit": "classic",
            "theme": "theme-triton"
        }
    },
    

    location.search = "/?profile=classic";
    location.search = "/?profile=triton";
    

    但它并没有如预期的那样工作。有什么提示吗。

    0 回复  |  直到 7 年前
        1
  •  1
  •   scebotari66    7 年前

    你只到了一半。senchacmd将为您的主题生成不同的清单。现在您必须在加载应用程序时选择相应的清单。看看 Dynamic Manifest

    有时可能需要选择构建配置文件 客户端。为了简化这一点,Microloader定义了一个hook方法 打电话加载前外部. 如果您将此方法定义为如下所示, 您可以控制的名称或内容外景舱单在 微加载程序处理它的同时利用其平台检测。

    对于你的情况应该是这样的:

    <script type="text/javascript">
        var Ext = Ext || {};
        Ext.beforeLoad = function (tags) {
            var theme = location.href.match(/profile=([\w-]+)/);
            theme  = (theme && theme[1]) || 'classic';
            Ext.manifest = theme;
        };
    </script>