如何在sencha touch中使用现有的js库(modernizr)

时间:2013-10-11 13:31:51

标签: extjs menu touch libraries modernizr

我发现了一个很酷的菜单,我希望将其添加到我的应用中(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

1 个答案:

答案 0 :(得分:0)

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