gpt4 book ai didi

javascript - 在项目单击上提交选中的 Atlaskit Dropdown(@atlaskit/dropdown-menu) 菜单复选框

转载 作者:行者123 更新时间:2023-12-03 00:49:30 30 4
gpt4 key购买 nike

我正在使用@atlaskit/dropdown-menu (https://atlaskit.atlassian.com/packages/core/dropdown-menu)。我想在 Item 点击时提交一个小表单,我需要提交 DropdownItemCheckbox 的值。

这里是渲染所需组件的代码:https://codesandbox.io/s/py8qoo64mq

import React from "react";
import Dropdown, {
DropdownItemCheckbox,
DropdownItemGroupCheckbox,
DropdownItem
} from "@atlaskit/dropdown-menu";

export default () => (
<Dropdown defaultOpen triggerType="button" trigger="Drop menu">
<DropdownItemGroupCheckbox id="languages2" title="Languages">
<DropdownItemCheckbox defaultSelected id="js-check">
JavaScript
</DropdownItemCheckbox>
<DropdownItemCheckbox id="java">Java</DropdownItemCheckbox>
<DropdownItemCheckbox defaultSelected id="ruby">
Ruby
</DropdownItemCheckbox>
</DropdownItemGroupCheckbox>
<DropdownItem>Submit</DropdownItem>
</Dropdown>
);

我不想使用Select,因为我想使用自定义按钮触发下拉列表,并利用 DropdownMenu 的分层优势

最佳答案

我也遇到了同样的问题,经过大量研究,我发现问题是由 styled-components 包引起的,但如果版本 <=3.5.0-0,它就可以工作。所以我的解决方案是将 styled-components 包降级到 3.5.0-0。这并不能解释为什么它不起作用,因为它们只是样式。但目前这是一个解决方法。

在我提出问题后,Atlassian 向我发送了以下回复,我认为它可以回答您的问题。

Atlaskit doesn’t officially support styled-components v4 and above. We currently require that our consumers use SC v3.2.6 as per our peer dependency. However, recently there has been some ongoing work to upgrade / migrate Atlaskit to a more modern css-in-js library and we’re working through the decision making process internally at the moment. Please feel free to follow this ticket for status updates: https://ecosystem.atlassian.net/browse/DS-6836

关于javascript - 在项目单击上提交选中的 Atlaskit Dropdown(@atlaskit/dropdown-menu) 菜单复选框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53113561/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com