角度虚拟滚动

时间:2021-07-28 14:20:13

标签: angular angular10 angular-cdk-virtual-scroll

我们使用的是 Angular 10.0.9。我只是尝试向页面添加虚拟滚动并遵循 official documentation:

  1. 在 app.module.ts 中导入 ScrollingModule

enter image description here

  1. 添加带有 cdk-virtual-scroll-viewportitemSize 并添加 *cdkVirtualFor 以迭代数组

enter image description here

  1. 浏览器记录了以下异常(在不同的浏览器上尝试过):

enter image description here

你们知道我错过了什么吗? 找了很多都没有成功,每个例子都按照上面的步骤进行。

更新 package.json

"dependencies": {
    "@angular/animations": "~10.0.6",
    "@angular/cdk": "^10.2.7",
    "@angular/common": "~10.0.6",
    "@angular/compiler": "~10.0.6",
    "@angular/core": "~10.0.6",
    "@angular/forms": "~10.0.6",
    "@angular/material": "^10.2.7",
    "@angular/platform-browser": "~10.0.6",
    "@angular/platform-browser-dynamic": "~10.0.6",
    "@angular/platform-server": "~10.0.6",
    "@angular/router": "~10.0.6",
    "@auth0/angular-jwt": "^5.0.1",
    "@microsoft/applicationinsights-web": "~2.4.4",
    "@ngrx/data": "^10.0.0",
    "@ngrx/effects": "^10.0.0",
    "@ngrx/entity": "^10.0.0",
    "@ngrx/router-store": "^10.0.0",
    "@ngrx/schematics": "^10.0.0",
    "@ngrx/store": "^10.0.0",
    "@ngrx/store-devtools": "^10.0.0",
    "@nguniversal/express-engine": "^10.0.2",
    "@ngx-translate/core": "^13.0.0",
    "@ngx-translate/http-loader": "^6.0.0",
    "core-js": "^3.6.5",
    "express": "^4.15.2",
    "flatpickr": "^4.6.6",
    "jquery": "^3.5.1",
    "js-sha256": "^0.9.0",
    "msal": "^1.3.4",
    "ngx-cookie-service": "^10.0.1",
    "rxjs": "~6.5.5",
    "tslib": "^2.0.0",
    "zone.js": "~0.10.3"
  }

0 个答案:

没有答案