小编Had*_*eez的帖子

无法单击可单击 div 内的按钮

我在 React 中使用 Chakra UI,当我尝试单击可点击框内的按钮时,框的功能正在执行。Z-index 也没有解决这个问题。

我的代码:

<Box
   w="90%"
   h="auto"
   mt="10px"
   position="relative"
   key={index}
   borderWidth="1px"
   borderRadius="lg"
   onClick={() =>
   history.push(`/products/${item.cat_name}/${item.id}`)}
>
 <h1 className={styles.heading_bold}>{item.cat_name}</h1>
<Button position="absolute" top="3" right="3" zIndex="0"> //Button not able to click
 Options
</Button
</Box>
Run Code Online (Sandbox Code Playgroud)

代码沙盒链接

html css jsx reactjs chakra-ui

1
推荐指数
1
解决办法
3376
查看次数

标签 统计

chakra-ui ×1

css ×1

html ×1

jsx ×1

reactjs ×1