jd-opensource / jd-opensource/nutui

[FR]: Popover 能否增加一个参数,设置弹窗的宽度于目标节点宽度相同?

Open
#2,500 0 comments 0 reactions 0 assignees View on GitHub
Feature Request PR Welcome
Dominant language
Vue
Stars
6.5k
Forks
835
PR merge metrics
No merged PRs in 30d

Description

### 这个功能解决了什么问题?

![image](https://github.com/jdf2e/nutui/assets/9612078/7133a8c4-c5dc-4250-bd56-913d9eac61cc)

希望能和上面input框等宽,这种需求应该是比较常见的

### 你期望的组件设计是怎样的?

// 获取宽度
`
const getContentWidth = () => {
let rect = useRect(popoverRef.value);
if (props.targetId) {
rect = useRect(document.querySelector(`#${props.targetId}`) as Element);
}
rootRect.value = rect;
setTimeout(() => {
conentRootRect.value = {
height: popoverContentRef.value.clientHeight,
width: popoverContentRef.value.clientWidth
};
}, 0);
};
`

新增参数 控制一下 conentRootRect 的宽度是否取rootRect的

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.