gpt4 book ai didi

Angular DevExtreme 主题

转载 作者:行者123 更新时间:2023-12-05 07:28:08 28 4
gpt4 key购买 nike

我正在尝试为 Angular 的 DevExtreme 小部件加载主题。我采用了不同的方法:

  1. 在 angular.json 中设置样式但不会产生任何影响:

    "projects": {
    "my-project": {
    "root": "",
    "sourceRoot": "src",
    "projectType": "application",
    "architect": {
    "build": {
    "builder": "@angular-devkit/build-angular:browser",
    "options": {
    "outputPath": "dist",
    "index": "src/index.html",
    "main": "src/main.ts",
    "tsConfig": "src/tsconfig.app.json",
    "polyfills": "src/polyfills.ts",
    "assets": [
    "src/assets",
    "src/favicon.ico",
    "src/manifest.json"
    ],
    "styles": [
    "node_modules/font-awesome/css/font-awesome.min.css",
    "node_modules/material-design-icons/iconfont/material-icons.css",
    "node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
    "node_modules/devextreme/dist/css/dx.common.css",
    "node_modules/devextreme/dist/css/dx.dark.css",
    "src/sass/styles.scss"
    ],
  2. 在index.html中设置也没有效果:

    <head>
    ...
    <link rel="dx-theme" data-theme="generic.dark" href="https://cdn3.devexpress.com/jslib/18.2.3/css/dx.dark.css" data-active="true" />
    </head>

并用 DxThemes.current('generic.dark'); 设置它

  1. 使用 (2) 中的语言环境 css 文件:

    <head>
    ...
    <link rel="dx-theme" data-theme="generic.dark" href="css/dx.dark.css" data-active="false" />
    </head>

但是我的浏览器说:

Refused to apply style from 'http://localhost:4200/css/dx.dark.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

所以我的问题是:我如何使用语言环境 css 文件?为什么没有应用主题?

最佳答案

技巧是使用 ng build --prod 构建项目。使用 ng serve 或没有生产模式它不起作用......

关于Angular DevExtreme 主题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53609739/

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