小编ael*_*ael的帖子

Visual Studio 警告:(ESLint)无法加载配置“defaults/configurations/eslint”来扩展。引用自 C:\Users\{username}\.eslintrc

在 Visual Studio 2019 社区版中。16.5.4 带有导入和导出声明的打字稿文件会显示警告。

“错误列表”选项卡,警告

打字稿文件的编辑器窗口中的注释:

如果未打开文件,则不会显示警告。但是当我打开一个打字稿文件时,就会出现警告。

它是 angular 9 的入门模板。我添加了一些包(bootstrap、jwt-decode、fontawesome、jquery、popper.js)

import visual-studio typescript eslint angular

6
推荐指数
1
解决办法
2603
查看次数

类型EventTarget上不存在属性innerWidth

当我运行代码时:

public onResize(event: Event) {
    console.log(event.target.innerWidth);

    //--solution--
    //var w = event.target as Window;
    //console.log(w.innerWidth);
  }
Run Code Online (Sandbox Code Playgroud)

我收到一个错误:

Property innerWidth does not exist on type EventTarget
Run Code Online (Sandbox Code Playgroud)

我想避免在TypeScript中扩展类型(如此处所述,类型'EventTarget'上不存在属性'value'),所以我将event.target强制转换Window类。我不确定是否要上适当的课。我应该选哪个班?如何找到应上的适当班级?

javascript casting typescript

5
推荐指数
2
解决办法
706
查看次数

angular 5 bootstrap-select:selectpicker 不是一个函数

我想为 angular 5 应用程序安装npm bootstrap-select所以我使用 npm 安装了它

npm install bootstrap-select
Run Code Online (Sandbox Code Playgroud)

然后我安装了所需的依赖项:

npm install jquery
npm install popper.js --save
Run Code Online (Sandbox Code Playgroud)

角度cli.json:

 "apps": [
    {
      "styles": [
        "styles.css"
      ],
      "scripts": [ "../node_modules/jquery/dist/jquery.min.js" ],
    }
  ],
Run Code Online (Sandbox Code Playgroud)

我的 package.json 是(我从列表中删除了一些包):

"dependencies": { 
    (...)
    "@ng-bootstrap/ng-bootstrap": "^1.1.0",
    "bootstrap": "^4.1.1",
    "bootstrap-select": "^1.13.2",
    "jquery": "^3.3.1",
    "ng-multiselect-dropdown": "^0.2.1",
    "popper.js": "^1.14.4",
}
Run Code Online (Sandbox Code Playgroud)

在 html 文件中,我添加了代码:

<ng-template #modalWindow let-c="close" let-d="dismiss">
  <div class="modal-header">
    <h4 class="modal-title">Options</h4>
    <button type="button" class="close" aria-label="Close" (click)="d('Cross click')">
      <span aria-hidden="true">&times;</span>
    </button>
  </div>

  <div class="modal-body">     
    <select id="myspID" #selectPickerRef class="selectpicker …
Run Code Online (Sandbox Code Playgroud)

bootstrap-select bootstrap-4 angular5

5
推荐指数
1
解决办法
4376
查看次数