Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
每次单击输入时,我都需要更改自定义值的输入值。这是代码。我试过了@ViewChild,但它只在第一次工作。如果我在第一次单击组件后粘贴某些内容 - 当我再次单击输入时,值不会改变。为什么会这样?谢谢
@ViewChild
您可以像这样使用 (focus) 和 (focusout) :
<input name="date" type="text" (focus)="focusFunc()" (focusout)="focusOutFunc()">