Javascript 在iframe中使用URL参数筛选视图?

Javascript 在iframe中使用URL参数筛选视图?,javascript,iframe,extjs,Javascript,Iframe,Extjs,我在extjs中使用iframe,我想根据url参数显示不同的视图 items: [{ xtype: "component", autoEl: { tag: "iframe", src: "/xyz/bin/view/Main/?key=abcd", html: "Loading...", } }] 这里我展示的是xyz web应用程序索引页面,我想在同一个iframe中

我在extjs中使用iframe,我想根据url参数显示不同的视图

items: [{
         xtype: "component",
         autoEl: {
         tag: "iframe",
         src: "/xyz/bin/view/Main/?key=abcd",
         html: "Loading...",
         }
        }]
这里我展示的是xyz web应用程序索引页面,我想在同一个iframe中从url参数显示这个应用程序的另一个页面。我们怎样才能做到这一点


我得到了这个问题的解决方案。为此,我添加了listener afterrender,并获得了iframe对象和set src

listeners: {
        afterrender: function () {
              var params=Ext.urlDecode(location.search.substring(1));
              Ext.get('iframe').dom.src = "http://www.google.com";                                                 

        this.getEl().on('load', function () {
                  console.log('loaded');
                });
           }

我得到了这个问题的解决方案。为此,我添加了listener afterrender,并获得了iframe对象和set src

listeners: {
        afterrender: function () {
              var params=Ext.urlDecode(location.search.substring(1));
              Ext.get('iframe').dom.src = "http://www.google.com";                                                 

        this.getEl().on('load', function () {
                  console.log('loaded');
                });
           }