想选择 在组件中选择自己template里的dom元素,要使用ElementRef。 import { Component, EventEmitter, HostListener, OnInit, Input, AfterViewInit, ElementRef } from '@angular/core'; 转载于:https://www.cnblogs.com/xuanmanstein/p/8205245.html