我收到错误:SyntaxError: Missing: after property id 1: at line 2

问题描述 投票:0回答:1
var oList = {
  "NO EXCEPTIONS TAKEN:" - 1,
  "MAKE CORRECTIONS NOTED:" - 1,
  "REVISE AND          RESUBMIT:" - 1,
  "REJECTED:" - 1
};
var dlg = initialize: {
    function(dialog)
  } {
    dialog.load({
      lst1: oList
    });
  },
  commit: function(dialog)
} {
  this.oSelect = dialog.store().lst1;
}, description: {
  name: “Review Action”,
  elements: [{
    type: “view”,
    elements: [{
        type: “static_text”,
        item_id: “stat”,
        name: “Select an Item”
      },
      {
        type: “popup”,
        item_id: “lst1”,
        char_width: 6
      },
      {
        type: “ok”
      }
    ]
  }]
}
`
    };

这适用于 Adobe 图章,让用户选择添加到图章的响应。我尝试了各种方法来标记

var dlg = initialize: {function(dialog)}
但没有任何效果。我怀疑我还有其他格式错误。

javascript
1个回答
0
投票

函数表达式中的花括号放错了位置。函数表达式的语法是

function(parameters) {
    body
}

更正的说法是:

var dlg = {
  initialize: function(dialog) {
    dialog.load({
      lst1: oList
    });
  },
  commit: function(dialog) {
    this.oSelect = dialog.store().lst1;
  },
  description: {
    name: "Review Action",
    elements: [{
      type: "view",
      elements: [{
        type: "static_text",
        item_id: "stat",
        name: "Select an Item"
      }, {
        type: "popup",
        item_id: "lst1",
        char_width: 6
      }, {
        type: "ok"
      }]
    }]
  }
};
© www.soinside.com 2019 - 2024. All rights reserved.