我在两周前将我的完整项目更新为angular 5,我注意到事件(mouseenter)(mouseleave)在我的组件上不再工作了。 这之前完美无缺。 这是被弃用的东西还是我错过了导入?
(点击)工作... comp的html模板
<i *ngFor="let step of steps"
#ratingPicker
[ngClass]="{
'fa-star': !step.half && step.selected,
'fa-star-o': !step.half && !step.selected,
'fa-star-half-o': step.half,
'pre-selected': step.pre_selected,
'selected': step.selected,
'fa-lg': (size == 1),
'fa-2x': (size == 2),
'fa-3x': (size == 3)
}"
(mouseenter)="onMouseEnter(step, $event)"
(mouseleave)="onMouseLeave(step, $event)"
(mousemove)="onMouseMove(step, $event, ratingPicker.getBoundingClientRect().width)"
(click)="setRating(step.index)"
class="feedbacks-element fa" aria-hidden="true">
组件
import {Component, OnInit, Input, Output, EventEmitter, AfterViewInit} from '@angular/core';
@Component({
selector: 'rating-picker',
templateUrl: './rating-picker.html',
styleUrls: ['./rating-picker.css']
})
export class RatingPickerComponent implements OnInit, AfterViewInit {
答案 0 :(得分:1)
您的问题可能源于Safari的兼容性问题。解决方案来自这个答案:Default Angular-CLI Project Fails in Safari - culprit strict mode?
npm install webpack-dev-server@2.7.1 --dev
cp -R ./node_modules/webpack-dev-server ./node_modules/@angular/cli/node_modules/
ng serve