[英]PrimeNG toolbar button with dropdown appears in the wrong place
I've made a stackblitz example here to show the issue: https://stackblitz.com/edit/primeng-toolbar-demo-u21zmt?file=src%2Fapp%2Fapp.component.html我在这里做了一个 stackblitz 示例来说明问题: https://stackblitz.com/edit/primeng-toolbar-demo-u21zmt?file=src%2Fapp%2Fapp.component.html
When clicking the remove button the popup menu shows in the wrong place.单击删除按钮时,弹出菜单显示在错误的位置。
I don't want to have to write custom CSS to position the menu every time I want to use it.我不想每次我想使用菜单时都将自定义 CSS 写入 position 菜单。
What am I doing wrong?我究竟做错了什么?
Switch the order in your html so在您的 html 中切换顺序
<p-button class="p-mr-2" #removeBtn type="button" icon="pi pi-chevron-down" label="Remove"
(click)="removeMenu.toggle($event)"></p-button>
<p-menu #removeMenu [model]="removeMenuItems" [popup]="true" appendTo="removeBtn"></p-menu>
becomes变成
<p-menu #removeMenu [model]="removeMenuItems" [popup]="true" appendTo="removeBtn"></p-menu>
<p-button class="p-mr-2" #removeBtn type="button" icon="pi pi-chevron-down" label="Remove"
(click)="removeMenu.toggle($event)"></p-button>
This will make the menu appear under "remove"这将使菜单出现在“删除”下
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.