使用核心下拉菜单选择多个项目 [英] Using core-dropdown to select multiple items

查看:88
本文介绍了使用核心下拉菜单选择多个项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当用户单击报告按钮时,他们应该能够选择一种或多种类型的问题.我正在尝试这样的事情:

When a user clicks in a report button, they should be able to select one or more types of issues. I'm trying something like this:

<core-icon-button icon="report" on-tap="{{ openDropdown }}">
   <core-dropdown>
      <core-selector valueattr="label" multi>
         <core-item label="Type 1"></core-item>
         <core-item label="Type 2"></core-item>
         <core-item label="Type 3"></core-item>
      </core-selector>
      <button on-tap="{{ reportIssue }}">Report</button>
   </core-dropdown>
</core-icon-button>

但是,当我选择任何项目时,下拉菜单将关闭.我的预期行为是仅在调用reportIssue之后关闭下拉列表.

But when I select any item the dropdown closes. My expected behaviour would be to close the dropdown only after reportIssue is called.

我正在尝试使用core-dropdown(或任何其他核心元素)做什么,还是应该为此构建自定义元素?感觉很浪费,因为core-dropdown已经提供了我所需的几乎所有行为.

Is what I'm trying to do possible with core-dropdown (or any other core element) or should I build a custom element for this? Feels like a waste since almost all the behaviour I need is provided already by core-dropdown.

问题似乎是我在core-icon-button中有core-dropdown.我更改之后,一切都会按预期进行. :)

The problem seems to be that I had core-dropdown inside core-icon-button. After I changed that everything works as expected. :)

推荐答案

尝试closeAttributecloseSelector.请参见core-overlay文档

这篇关于使用核心下拉菜单选择多个项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆