gpt4 book ai didi

angular - ngx-datatable 不能在环境上下文中声明访问器

转载 作者:行者123 更新时间:2023-12-01 21:39:41 24 4
gpt4 key购买 nike

我在尝试将 ngx-datatable 添加到我的 ionic + angular 项目时遇到错误。我收到了成百上千的错误行,它似乎没有将 ngx-database 添加到我的项目中。我正在关注 Add ngx-datatable with ionic 5ngx-datatable 添加到我的项目中。

包.json

"@angular/common": "~8.2.14",
"@angular/core": "~8.2.14",
"@angular/forms": "~8.2.14",
"@angular/platform-browser": "~8.2.14",
"@angular/platform-browser-dynamic": "~8.2.14",
"@angular/router": "~8.2.14",
"@ionic-native/core": "^5.0.7",
"@ionic-native/splash-screen": "^5.0.0",
"@ionic-native/status-bar": "^5.0.0",
"@ionic/angular": "^5.0.0",
"@swimlane/ngx-datatable": "^17.0.0",
"core-js": "^2.5.4",
"rxjs": "~6.5.1",
"tslib": "^1.9.0",
"zone.js": "~0.9.1"

在 app/home.module.ts 中

import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { CommonModule } from '@angular/common';
import { IonicModule } from '@ionic/angular';
import { FormsModule } from '@angular/forms';
import { HomePage } from './home.page';
import { HomePageRoutingModule } from './home-routing.module';
import { NgxDatatableModule } from '@swimlane/ngx-datatable';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
HomePageRoutingModule, NgxDatatableModule
],
declarations: [HomePage],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class HomePageModule {}

和错误

ERROR in node_modules/@swimlane/ngx-datatable/lib/components/body/body-cell.component.d.ts:8:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 8 set group(group: any);

node_modules/@swimlane/ngx-datatable/lib/components/body/body-cell.component.d.ts:9:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 9 get group(): any;

我想我的 ionic+angular 版本不兼容或 ngx-datatable 不兼容或我正在努力解决的任何其他错误。

最佳答案

解决了。 ngx-datatable 版本 17.0.0 与我在 package.json 文件中的 ionic + Angular 版本不兼容。我只是安装了 ngx-datatable 16.1.1 版本并解决了问题。

npm i @swimlane/ngx-datatable@16.1.1 --save

关于angular - ngx-datatable 不能在环境上下文中声明访问器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61546288/

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