【问题标题】:Execute a function without opening input在不打开输入的情况下执行功能
【发布时间】:2020-01-14 05:05:08
【问题描述】:

我开发了一个输入,允许我选择多个文件。在这些选定的文件中,我显示了名称和类型。

在单击时的名称和类型类中,我认为执行了一个功能,但是每当我单击那里时,输入总是打开的。

点击标签执行function()函数时如何防止输入打开。

谁能帮帮我?

DEMO

HTML

<ngx-dropzone (change)="onSelect($event)">
    <ngx-dropzone-preview *ngFor="let f of files" [removable]="true" (removed)="onRemove(f)">
        <ngx-dropzone-label (click)="function()">({{ f.type }})
      </ngx-dropzone-label>
        <ngx-dropzone-label (click)="function()">{{ f.name }} </ngx-dropzone-label>
    </ngx-dropzone-preview>
</ngx-dropzone>

【问题讨论】:

    标签: html css angular typescript


    【解决方案1】:

    停止事件冒泡应该可以解决问题。

    $event.stopPropagation()
    

    查看修改后的示例here ->

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-09-30
      • 2018-11-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-09-12
      • 2013-05-09
      相关资源
      最近更新 更多