gpt4 book ai didi

sapui5 - 为什么 WebIde 显示 alert 和 console.log 错误?

转载 作者:行者123 更新时间:2023-12-01 00:01:29 25 4
gpt4 key购买 nike

我用的是SAPUI5开发的WebIde。

如果我写一个 console.logalert 它会在编辑器内部显示意外警报等错误。

虽然代码可以运行,但我不想在编辑器中看到这些错误。

如何自定义 WebIde 以不显示此类错误。

最佳答案

虽然不鼓励在您的代码中使用console.logalert 语句,因为

[...] such messages are considered to be for debugging purposes and therefore not suitable to ship to the client [...]

http://eslint.org/docs/rules/no-console

[...] JavaScripts’ alert, confirm, and prompt functions are widely considered to be obtrusive as UI elements and should be replaced by a more appropriate custom UI implementation [...]

http://eslint.org/docs/rules/no-alert

您可以将 Linter 配置为绕过这些检查(尽管我建议这样做)

但请记住,这些检查并非特定于 SAPUI5 或 Web IDE,而是针对每个 Javascript 项目!

无论如何,由于 Web IDE 使用 ESLint,要禁用检查,请在受影响的 Javascript 文件顶部添加以下内容:

/*eslint-disable no-console, no-alert */

关于sapui5 - 为什么 WebIde 显示 alert 和 console.log 错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40104214/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com