在Visual Studio 2017 Angular 7项目中,我正在使用PrimeNG版本6.1.7。我有一个包含多个子组件的组件,其中一些子组件使用PrimeNG日历。到2019年3月6日,这一切都没有问题,当时我向客户交付了工作代码。
但是,如果我从代码存储库中提取相同的代码并立即运行应用程序,则单击input元素只会显示该元素呈现的灰色叠加层:
<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"
}
}
}