首页 > 解决方案 > Cumulocity 服务器中的 CSS 样式问题

问题描述

我已经在 cumulocity 服务器中部署了我的 angular 7 项目。构建和部署应用程序时没有错误。但是,Bootstrap CSS 样式不能正常工作。

在 package.json 中,我提到了这些依赖项。“@c8y/ngx-components”:“1004.2.0”,“@c8y/style”:“1004.2.0”,“@ng-bootstrap/ng-bootstrap”:“^4.1.0”,

在此处输入图像描述

标签: angular7cumulocity

解决方案


在新的 Angular Web SDK 中,Cumulocity 团队切换到ngx-bootstrap。它包含在 ngx-components 中,因此无需添加。

您的问题可能是缺少某些样式,因为 Cumulocity 只是带有引导程序的一个子集。您可能需要将引导 CSS 添加到您的应用程序以使其正常工作:

  1. 在 package.json 中添加品牌条目:
"c8y": {
    "application": {
      "name": "tutorial application",
      "contextPath": "tutorial-application",
      "key": "tutorial-application-key",
      "brandingEntry": "./branding/branding.less",
      "globalTitle": "Pied Piper IoT",
      "tabsHorizontal": true
    }
  }
  1. 然后在该文件中添加@c8y 样式和引导程序:
@import '~@c8y/style/extend.less';
@import '~yourpatt/to/boostrap.css';

推荐阅读