let registerDropdownHandler = (options, handler) => {
this.element.addEventListener('contextmenu', (e) => {
e.preventDefault();
e.stopPropagation();
let options = options;
if (this.additionalDropdownOptions) options.push(...this.additionalDropdownOptions);
let dropdown = openDropdown(e.clientX, e.clientY, options);
dropdown.onselect = function(name) {
handler(name);
if (this.additionalDropdownHandler) this.additionalDropdownHandler(name);
};
});
};
是的,我知道语句let options = options
在这里是多余的,但是为什么会抛出?它将引发“未捕获的ReferenceError:未定义选项”。