JS-定义显示sencha窗口功能

时间:2019-01-04 16:01:59

标签: function extjs

我正在尝试将此过程分配给某个函数,因此我可以向按钮添加侦听器,但是它一直给我“参数列表后出现Uncaught SyntaxError:missing”。谁能引导我正确的方向?

function popWindow() {
Ext.create('Ext.window.Window', {
    bodyStyle: "background-color:#FFFFFF",
    title: 'QA Tools',
    height: 300,
    width:400,
    layout: 'absolute',
    items: [{
        xtype: 'button',
        x: 15,
        y: 35,
        height: 35,
        width: 125,
        text: 'Sell Listings',
        itemId: 'sellBtn',
    }, {
		xtype: 'button',
        x: 15,
        y: 90,
        height: 35,
        width: 125,
        text: 'Set SP Cycle to 1 Min',
        itemId: 'sp1MinBtn',
	}, {
		xtype: 'button',
        x: 15,
        y: 145,
        height: 35,
        width: 175,
        text: 'Set Single AP Cycle to 1 min',
        itemId: 'singleAPMinBtn',
	}, {
		xtype: 'button',
        x: 15,
        y: 200,
        height: 35,
        width: 175,
        text: 'Set Grouped AP Cycle to 1 min',
        itemId: 'groupedAPMinBtn',
	},  {
		xtype: 'textfield',
        x: 170,
        y: 36,
        height: 30,
        width: 175,
        allowBlank: false,
        minLength: 7,
        maxLength: 7,
        emptyText: 'Enter Listing ID',
        itemId: 'sellListingField',
	}]
}
}).show();

任何人都可以帮助我使它正常工作吗?

1 个答案:

答案 0 :(得分:0)

是的,您的JavaScript无效。通常,这样的警告意味着您有一些格式错误的代码。我建议通过前缀like this one运行它,以帮助将大括号对准并查找问题。当我们用您的代码执行此操作时,我们会看到2个错误。

  1. 您不会以大括号结束该功能
  2. .show前面的括号太多了

应该看起来像这样

function popWindow() {
    Ext.create('Ext.window.Window', {
        bodyStyle: "background-color:#FFFFFF",
        title: 'QA Tools',
        height: 300,
        width: 400,
        layout: 'absolute',
        items: [{
            xtype: 'button',
            x: 15,
            y: 35,
            height: 35,
            width: 125,
            text: 'Sell Listings',
            itemId: 'sellBtn',
        }, {
            xtype: 'button',
            x: 15,
            y: 90,
            height: 35,
            width: 125,
            text: 'Set SP Cycle to 1 Min',
            itemId: 'sp1MinBtn',
        }, {
            xtype: 'button',
            x: 15,
            y: 145,
            height: 35,
            width: 175,
            text: 'Set Single AP Cycle to 1 min',
            itemId: 'singleAPMinBtn',
        }, {
            xtype: 'button',
            x: 15,
            y: 200,
            height: 35,
            width: 175,
            text: 'Set Grouped AP Cycle to 1 min',
            itemId: 'groupedAPMinBtn',
        }, {
            xtype: 'textfield',
            x: 170,
            y: 36,
            height: 30,
            width: 175,
            allowBlank: false,
            minLength: 7,
            maxLength: 7,
            emptyText: 'Enter Listing ID',
            itemId: 'sellListingField',
        }]
    }).show();
}