【问题标题】:How to use existing js libraries in sencha touch (modernizr)如何在 sencha touch (modernizr) 中使用现有的 js 库
【发布时间】:2013-10-11 13:31:51
【问题描述】:

我找到了一个很酷的菜单,我想将其添加到我的应用中 (http://tympanus.net/codrops/2013/08/...vel-push-menu/)。

所有文件都在正确的文件夹中。

起初我尝试将源代码包含在 index.html 中,但没有成功。 然后它试图通过一个 HTML 面板来做:

HTMLPanel.js

Ext.define('HTMLPanel', {    extend: 'Ext.Panel',


// We are using Ext.Ajax, so we should require it
requires: ['Ext.Ajax'],


config: {
    listeners: {
        activate: 'onActivate'
    },


    // Create a new configuration called `url` so we can specify the URL
    url: null
},


onActivate: function(me, container) {
    Ext.Ajax.request({
        // we should use the getter for our new `url` config
        url: this.getUrl(),
        method: "GET",
        success: function(response, request) {
            // We should use the setter for the HTML config for this
            me.setHtml(response.responseText);
        },
        failure: function(response, request) {
            me.setHtml("failed -- response: " + response.responseText);
        }
    });
}

}); app.js

var HTMLPanel = Ext.create('HTMLPanel', {            // this is now `scrollable`, not `scroll`
        //scroll: 'vertical',
        scrollable: 'vertical',


        url: 'menu.html'
    });

    // Add the new HTMLPanel into the viewport so it is visible
    Ext.Viewport.add(HTMLPanel);

该解决方案仅加载 HTML 代码,但不启动脚本以加载菜单。

我在 index.html 中包含了需要的文件,如下所示:

<link rel="stylesheet" type="text/css" href="css/normalize.css" />    <link rel="stylesheet" type="text/css" href="css/demo.css" />
<link rel="stylesheet" type="text/css" href="css/icons.css" />
<link rel="stylesheet" type="text/css" href="css/component.css" />
<script src="js/modernizr.custom.js"></script>
<script src="js/classie.js"></script>
<script src="js/mlpushmenu.js"></script>

任何正确方向的提示将不胜感激!

我已经尝试过解决方案。它有效,但很难以这种方式对其余内容进行适当的布局!

最好的问候,manu

【问题讨论】:

    标签: extjs menu touch libraries modernizr


    【解决方案1】:

    您应该能够将静态 JS 资源添加到您的 app.json 文件中。

    【讨论】:

      猜你喜欢
      • 2013-02-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多