Uncaught TypeError: Cannot read property 'dom' of null CQ - extjs

Uncaught TypeError: Cannot read property 'dom' of null CQ - extjs

我在控制台中收到“Uncaught TypeError: Cannot read 属性 'dom' of null”错误,不确定以下代码有什么问题。 感谢任何帮助。

 <div id='fi-form'></div>
 <script>
    CQ.Ext.onReady( function(){


    var card = new CQ.Ext.Panel({
         applyTo : 'fi-form',
         title: 'Example Wizard',
         layout:'form',
         activeItem: 0, 
          bodyStyle: 'padding:15px',
          defaults: {
              // applied to each contained panel
             border:false
           },
      // the panels (or "cards") within the layout

     items: [{
    id: 'card-0',
    xtype: 'fileuploadfield',
    fieldLabel: 'Photo',
    name: 'photo-path',
    buttonCfg: ' '

 }]
});

});
</script>

是因为你的空buttonCfg属性。删除它,您应该不会再看到此错误。

如果您使用的是 CQ 5.5 及更高版本,那么最好使用 html5fileuploadfield

<div id='fi-form'></div>
<script>
    CQ.Ext.onReady( function(){
        var card = new CQ.Ext.Panel({
            applyTo : 'fi-form',
            title: 'Example Wizard',
            layout:'form',
            activeItem: 0, 
            bodyStyle: 'padding:15px',
            defaults: {
                // applied to each contained panel
                border:false
            },
            // the panels (or "cards") within the layout
            items: [{
                id: 'card-0',
                xtype: 'html5fileuploadfield',
                fieldLabel: 'Photo',
                name: 'photo-path'
            }]
        });
    });
</script>