简体   繁体   English

单击时如何避免选择primeng按钮?

[英]How to avoid primeng button from getting selected when clicked?

I am working with normal buttons from primeng, those buttons get "selected" when clicked.我正在使用primeng的普通按钮,单击时这些按钮会被“选中”。 When I say "selected" I mean that some extra line appears around them and if I click anywhere this "selection" disappears.当我说“选择”时,我的意思是在它们周围出现了一些额外的线,如果我点击任何地方,这个“选择”就会消失。 As my buttons only call a method I do not want them to stay "selected", but I have not found any documentation about this particular property.由于我的按钮只调用一个方法,我不希望它们保持“选中”状态,但我还没有找到任何关于这个特定属性的文档。 I attach as an example the code of some of my buttons, any help is welcome.我附上我的一些按钮的代码作为示例,欢迎任何帮助。

            
        </button> &nbsp; <button pButton pRipple type="button" icon="pi pi-globe"
            class="p-button-outlined p-button-rounded" (click)="metodo=listaMetodos.camionesZona"
            (click)="busquedas.busqueda=filaSeleccionada.zona"
            (click)="this.llamarServicio(listaMetodos.camionesZona);">
        </button> ```

This is because the button becomes focused (which is normal behaviour in HTML).这是因为按钮变为焦点(这是 HTML 中的正常行为)。

If you only want to avoid the extra border around the button, then a css-Rule like this might help:如果您只想避免按钮周围的额外边框,那么像这样的 css-Rule 可能会有所帮助:

button:focus {
   border: none;
}

I don't know the css settings of primeng buttons, maybe instead of a border there is outline or a shadow.我不知道primeng按钮的css设置,可能不是边框而是轮廓或阴影。 In this case the css-rule should look like this:在这种情况下,css 规则应如下所示:

button:focus {
   outline: none;
   box-shadow: none;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 单击按钮时如何以编程方式触发刷新 primeNG 数据表 - How to programmatically trigger refresh primeNG datatable when a button is clicked Primeng Datatable-如何在该行中单击按钮时向特定的tr元素添加样式 - Primeng Datatable - How to add styles to particular tr element when a button is clicked in that row 在primeNG数据表中未选中复选框 - Checkbox not getting selected in primeNG datatable 单击对话框叠加层 (PrimeNG) 时如何设置 z-index? - How to set z-index when clicked with dialog overlays (PrimeNG)? 仅禁用Primeng表中某行的单击按钮 - Disable only the clicked button of a row in Primeng table PrimeNG 列表框,所有项目在单击之前都已选中。 使用 [multiple]=&quot;true&quot; 时,列表显示为选中状态 - PrimeNG Listbox, all the item were selected before even clicked. When used [multiple]="true" the list is shown as selected 我如何从 Primeng 获取选项卡菜单中的选定项目 - How do i get the selected Item in a Tabmenu from Primeng 如何避免使用 PrimeNG Dropdown 为多个 select 下拉菜单选择项目? - How do I avoid selected item for multiple select dropdown using PrimeNG Dropdown? PrimeNG:更改所选按钮的背景颜色 - PrimeNG: Change the background color of selected button 在angular5 / 6中单击按钮时如何从url下载文件 - How to download a file from a url when a button is clicked in angular5 / 6
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM