1

在 Visual Studio 2017 Angular 7 项目中,我使用的是 PrimeNG 版本 6.1.7。我有一个包含多个子组件的组件,其中一些子组件使用 PrimeNG 日历。截至 2019 年 3 月 6 日,这完全没有问题,当时我将工作代码交付给了客户。

但是,如果我从代码库中提取相同的代码并立即运行应用程序,则单击输入元素只会显示此元素呈现的灰色叠加层:

<div class="ui-widget-overlay ui-datepicker-mask ui-datepicker-mask-scrollblocker" style="z-index: 1002;"></div>

在 chrome 中调试时,如果我单击另一个应用程序(甚至是 Chrome 的 DevTools 窗口,从主窗口中取消停靠),然后单击覆盖,突然日期选择器显示,同时我看到,在 DevTools 的 Elements 选项卡中,以下 html 位于上面引用的 div 的正下方:

<div class="ng-trigger ng-trigger-overlayAnimation ng-tns-c23-2 ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all ui-shadow ui-datepicker-touch-ui ng-star-inserted" ng-reflect-ng-class="[object Object]" style="z-index: 1004; transform: translate(-50%, -50%); opacity: 1;">

!-- TONS OF HTML FOR THE DATEPICKER -->

</div> 

如前所述,我没有更改任何内容,所以我猜这是通过更新我的 package.json 文件中的每个设置所做的一些更改。

我一生都无法弄清楚发生了什么。如果我删除“touchUI = true”属性,那么日历确实会出现,但它没有在屏幕上正确居中(这是一个适合移动设备的应用程序)。任何帮助将非常感激。

一个示例日期控件(应用程序中的所有控件都有相同的问题):

<p-calendar [(ngModel)]="labor.laborServiceDate" [touchUI]="true"></p-calendar>

我的 package.json 文件:

{
  "name": "vIDix.Pulse.Mobile.Web",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build --extract-css --optimization=false",
    "build:ssr": "npm run build -- --app=ssr --output-hashing=media",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "7.1.3",
    "@angular/common": "7.1.3",
    "@angular/compiler": "7.1.3",
    "@angular/core": "7.1.3",
    "@angular/forms": "7.1.3",
    "@angular/http": "7.1.3",
    "@angular/platform-browser": "7.1.3",
    "@angular/platform-browser-dynamic": "7.1.3",
    "@angular/platform-server": "7.1.3",
    "@angular/router": "7.1.3",
    "@nguniversal/module-map-ngfactory-loader": "^5.0.0-beta.5",
    "angular-font-awesome": "^3.1.2",
    "angular2-signaturepad": "2.8.0",
    "angular2-cookie": "1.2.6",
    "aspnet-prerendering": "^3.0.1",
    "bootstrap": "^3.3.7",
    "core-js": "^2.4.1",
    "font-awesome": "^4.7.0",
    "ng2-validation": "4.2.0",
    "primeicons": "^1.0.0-beta.10",
    "primeng": "^6.1.3",
    "rxjs": "^6.3.3",
    "rxjs-tslint": "^0.1.6",
    "tslib": "^1.9.0",
    "zone.js": "^0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.11.0",
    "@angular/cli": "^7.1.3",
    "@angular/compiler-cli": "7.1.3",
    "@angular/language-service": "7.1.3",
    "@types/jasmine": "~2.8.3",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "~6.0.60",
    "codelyzer": "^4.0.1",
    "jasmine-core": "~2.8.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~2.0.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "^1.2.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.2",
    "ts-node": "~4.1.0",
    "tslint": "~5.9.1",
    "typescript": "3.1.6"
  },
  "optionalDependencies": {
    "node-sass": "^4.9.0"
  }
}

我的 angular.json 文件:

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "vIDix.Pulse.Mobile.Web": {
      "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",
            "progress": true,
            "polyfills": "src/polyfills.ts",
            "assets": [
              "src/assets"
            ],
            "styles": [
              "node_modules/bootstrap/dist/css/bootstrap.min.css",
              "node_modules/primeicons/primeicons.css",
              "node_modules/primeng/resources/themes/nova-light/theme.css",
              "node_modules/primeng/resources/primeng.min.css",
              "node_modules/font-awesome/css/font-awesome.css",
              "src/styles.css"
            ],
            "scripts": []
          },
          "configurations": {
            "production": {
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ]
            }
          }
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "vIDix.Pulse.Mobile.Web:build"
          },
          "configurations": {
            "production": {
              "browserTarget": "vIDix.Pulse.Mobile.Web:build:production"
            }
          }
        },
        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "vIDix.Pulse.Mobile.Web:build"
          }
        },
        "test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
            "main": "src/test.ts",
            "karmaConfig": "./karma.conf.js",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "src/tsconfig.spec.json",
            "scripts": [],
            "styles": [
              "src/styles.css",
              "node_modules/bootstrap/dist/css/bootstrap.min.css"
            ],
            "assets": [
              "src/assets"
            ]
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "src/tsconfig.app.json",
              "src/tsconfig.spec.json"
            ],
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    },
    "vIDix.Pulse.Mobile.Web-e2e": {
      "root": "e2e",
      "sourceRoot": "e2e",
      "projectType": "application",
      "architect": {
        "e2e": {
          "builder": "@angular-devkit/build-angular:protractor",
          "options": {
            "protractorConfig": "./protractor.conf.js",
            "devServerTarget": "vIDix.Pulse.Mobile.Web:serve"
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "e2e/tsconfig.e2e.json"
            ],
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    }
  },
  "defaultProject": "vIDix.Pulse.Mobile.Web",
  "schematics": {
    "@schematics/angular:component": {
      "prefix": "app",
      "styleext": "css"
    },
    "@schematics/angular:directive": {
      "prefix": "app"
    }
  }
}
4

0 回答 0