gpt4 book ai didi

angular - 如何包含 flex-layout?

转载 作者:行者123 更新时间:2023-12-03 14:45:52 25 4
gpt4 key购买 nike

我正在尝试将 flex-layout 添加到 angular 应用程序,但是当我这样做并尝试使用它时,应用程序会中断。我已经安装

npm i @angular/flex-layout @angular/cdk
然后在 app.module.ts 中导入
import { FlexLayoutModule } from '@angular/flex-layout';

import [ FlexLayoutModule ]
我还将 typescript 升级到最新版本
npm i typescript@latest
但是当应用程序尝试编译时,我收到各种错误:
ERROR in node_modules/@angular/flex-layout/core/typings/base/base2.d.ts:24:19 - error TS1086: An accessor cannot be declared in an ambient context.

24 protected get parentElement(): HTMLElement | null;
~~~~~~~~~~~~~
node_modules/@angular/flex-layout/core/typings/base/base2.d.ts:26:19 - error TS1086: An accessor cannot be declared in an ambient context.

26 protected get nativeElement(): HTMLElement;
~~~~~~~~~~~~~
node_modules/@angular/flex-layout/core/typings/base/base2.d.ts:28:9 - error TS1086: An accessor cannot be declared in an ambient context.

28 get activatedValue(): string;
~~~~~~~~~~~~~~
node_modules/@angular/flex-layout/core/typings/base/base2.d.ts:29:9 - error TS1086: An accessor cannot be declared in an ambient context.

29 set activatedValue(value: string);
~~~~~~~~~~~~~~
node_modules/@angular/flex-layout/core/typings/breakpoints/break-point-registry.d.ts:20:9 - error TS1086: An accessor cannot be declared in an ambient context.

20 get overlappings(): BreakPoint[];
~~~~~~~~~~~~
node_modules/@angular/flex-layout/core/typings/breakpoints/break-point-registry.d.ts:24:9 - error TS1086: An accessor cannot be declared in an ambient context.
而这样的例子不胜枚举。我的版本不匹配吗?

最佳答案

尝试在依赖项中添加 tslib

npm install --save tslib

编辑

如果您使用的是 Angular v8,则使用 v8 进行 flex-layout,因为 v9 需要 Angular v9。

关于angular - 如何包含 flex-layout?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59942761/

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