我已经解决了类似的问题,但没有一个答案有帮助,可能是因为最新的 VS Code 中的配置已更改,或者它们不相关。
当我尝试启动时出现此错误:
Exception has occurred: ReferenceError
ReferenceError: closeDescriptionPopup is not defined
at HTMLParagraphElement.eval (eval at E (chrome-error://chromewebdata/:14:208), <anonymous>:3:21)
at w (chrome-error://chromewebdata/:4622:845)
at L.b (chrome-error://chromewebdata/:4628:231)
at L.e (chrome-error://chromewebdata/:4627:393)
at window.jstProcess (chrome-error://chromewebdata/:4630:800)
at chrome-error://chromewebdata/:4632:56
Run Code Online (Sandbox Code Playgroud)
我的launch.json样子是这样的 请注意,由于各种尝试和错误,现在已经变成这样了:
{
"configurations": [
{
"name": "Launch Chrome",
"request": "launch",
"type": "pwa-chrome",
"url": "http://localhost:8080",
"webRoot": "${workspaceFolder}",
},
{
"name": "Attach by Process ID",
"processId": "${command:PickProcess}",
"request": "attach",
"skipFiles": [
"<node_internals>/**"
],
"type": "pwa-node"
},
{
"name": "Attach to Chrome",
"port": 9222,
"request": …Run Code Online (Sandbox Code Playgroud) 我在StackOverflow上经历了类似的问题和答案,发现了这个:
parseInt("123hui")
returns 123
Number("123hui")
returns NaN
Run Code Online (Sandbox Code Playgroud)
因为,parseInt()解析到第一个非数字并返回它解析的任何内容并Number()尝试将整个字符串转换为数字,为什么在parseInt('')和的情况下不太可能出现行为Number('').
我觉得理想情况下parseInt应该NaN像它一样回归Number("123hui")
现在我的下一个问题:
作为0 == ''回报true我相信它解释为0 == Number('')哪个是真的.那么编译器真的对待它0 == Number('')并不喜欢0 == parseInt('')或者我错过了一些观点吗?
我的 Web 应用程序的用户应该将错误报告作为 GitHub 问题提供,并带有预先生成的标题和正文。
这对于小型机构使用 GET 非常好:
const title = getLastErrorTitle();
const body = getAllTheLogMessages();
window.open(`https://github.com/theuser/therepo/issues/new?title=${encodeURIComponent(title)}&body=${encodeURIComponent(body)}`);
Run Code Online (Sandbox Code Playgroud)
如果用户已登录,GitHub 会向用户显示一个新问题,标题和正文已填写,完美。如果没有,GitHub 会提示用户登录,下次再运行。
但是,如果正文太大,则 GET 请求会因为 URL 变得太长而失败。
在查阅手册后,我尝试对 POST 做同样的事情,但我从 GitHub 获得了一个 404 并带有以下测试请求(为简洁起见是 jQuery):
$.ajax({
type: "POST",
url: "https://api.github.com/repos/theuser/therepo/issues",
data: data = {title: "Test", body: "Test Body"},
});
Run Code Online (Sandbox Code Playgroud)
我的怀疑是,GitHub API 的设计并没有考虑到我的用例,但是 POST 总是需要身份验证并一次性创建完整的问题,而不会让用户像使用 GET 那样事先更改它。
如何将 GET 方法的功能转移到 POST 方法?我只希望 GitHub 向当前登录浏览器的用户显示一个预填充的问题,而不需要令牌。
所以我在MDN上读了一篇关于 Promise 的文章,结果被困在这里:
与 Promise.resolve() 不同,Promise.reject() 始终将 Reason 包装在新的 Promise 对象中,即使 Reason 已经是 Promise 时也是如此。
我只是想了解它在编码方面有何不同。如果不像那样用另一个 PromiseReject包装会发生什么,以及这到底如何简化使用。reasonresolve
欣赏一些假设的例子。
这是代码:
<input type="text" onblur="myFunction()">
<div style="border: 1px solid; width:300px;height:300px" onmousedown = "myOtherFunction()">
function myOtherFunction(){
console.log("mousedown on div occurred");
}
function myFunction(){
console.log("blurr occurred");
}
Run Code Online (Sandbox Code Playgroud)
如果我在输入中输入一些内容并点击 div,这会按预期工作,mousedown在blur. 但是,如果我只是放入调试器myOtherFunction并打开开发人员工具,则blur事件不会被触发并且似乎丢失了。是否可能是因为调试器打开时发生的“延迟”?
我确实有一个 JavaScript 代码片段,它遍历一组字段以查找特定属性并将它们添加到字典中。另外,请参阅此站点以获取另一个示例。
return this.getFields()
.reduce((mappings, field) => ({...mappings, [field.id]: field.name}), {});
Run Code Online (Sandbox Code Playgroud)
这工作得很好。但是我收到了三个点的 Eslint 代码样式解析错误。
意外的标记 ...
关于这个的三个问题。
如何在保持代码简短的同时更改我的代码以避免解析错误?
我应该针对这个错误禁用 ESLint 检查吗?
...符号的名称是什么?
我的解决方法如下。但我更愿意保留原始版本。
return this.getFields()
.reduce(function(mappings, field) {
mappings[field.id] = field.name;
}, {});
Run Code Online (Sandbox Code Playgroud) 根据材料 UI 文档, https://next.material-ui.com/components/buttons/
您可以
import LoadingButton from '@material-ui/lab/LoadingButton';
但是,我在 mui/lab 中的任何地方都没有看到此文件夹,并且导入会引发错误。
我yarn add @material-ui/lab已经跑了。
我也"@material-ui/core"已经。
我是否需要为“下一个 mui”安装一些东西,因为我看到文档 url 也不同:https : //next.material-ui.com/
虽然我使用的大部分组件都在这里:https : //material-ui.com/
我希望我的 css 类根据条件进行更改。我正在尝试使用这个:
<div *ngIf="dropDownBg==='Active'">
<style type="text/css">
.ui-select-toggle{
background: green !important;
}
</style>
</div>
<div *ngIf="dropDownBg==='Suspended'">
<style type="text/css">
.ui-select-toggle{
background: red !important;
}
</style>
</div>
<div *ngIf="dropDownBg==='Disabled'">
<style type="text/css">
.ui-select-toggle{
background: grey !important;
}
</style>
</div>
Run Code Online (Sandbox Code Playgroud)
但这不起作用。默认情况下,浏览器似乎忽略divs了*ngIf并且只有最后一个样式覆盖了其他样式。以下是浏览器解释:
更新:出现这种情况是因为我正在使用ng-select下拉菜单,它在内部使用了我无法控制的类“ui-select-toggle”。所以奇怪的人反对这个问题,请注意这一点。
这是代码:
<div style="min-width: 200px;position: absolute;right: 0">
<ng-select
[items]="items"
(selected)="selected($event)"
[active]="selectedItem"
(removed)="removed($event)"
placeholder="Select a number">
</ng-select>
</div>
Run Code Online (Sandbox Code Playgroud) 我正在给一个元素上课success。但是 React-Mui 在 DoM 上附加了一个文本,比如mui-AbcXYZ-success. 所以当我这样做时
expect( getByTestId('thirdCheck')).toHaveClass("success")
我没有通过这个测试,因为它需要完整的名称mui-AbcXYZ-success。仅当我提供确切的名称(带有连字符的文本和 mui 添加的随机数)时,I\xe2\x80\x99m 才能通过此操作
我该如何测试呢?
\n我尝试执行以下操作但没有结果:\nexpect( getByTestId('thirdCheck')).toHaveClass(/success/)
我也尝试应用 .classNameor.classList但这并没有\xe2\x80\x99t 给我元素上的类列表。
javascript ×8
material-ui ×2
reactjs ×2
angular ×1
api ×1
css ×1
debugging ×1
dom-events ×1
eslint ×1
github ×1
github-api ×1
jestjs ×1
node.js ×1
post ×1
promise ×1