-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(dropdownmenu): 新增DropdownMenu组件 #503
base: develop
Are you sure you want to change the base?
Conversation
keys, | ||
} = useDefaultProps<DropdownItemProps>(props, dropdownItemDefaultProps); | ||
const { classPrefix } = useConfig(); | ||
const itemClass = `${classPrefix}-dropdown-item`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
改用 usePrefixClass()
import uniqueId from 'lodash/uniqueId'; | ||
import React, { FC, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react'; | ||
import { CaretDownSmallIcon, CaretUpSmallIcon } from 'tdesign-icons-react'; | ||
import { Button, Checkbox, Popup, Radio, RadioGroup } from 'tdesign-mobile-react'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
组件内部使用相对路径
@@ -0,0 +1,66 @@ | |||
import cx from 'classnames'; | |||
import React, { ComponentProps, FC, forwardRef, useImperativeHandle, useState } from 'react'; | |||
import { StyledProps } from 'tdesign-mobile-react/common'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
组件内部使用相对路径
useDefaultProps<DropdownMenuProps>(props, dropdownMenuDefaultProps); | ||
|
||
const { classPrefix } = useConfig(); | ||
const name = `${classPrefix}-dropdown-menu`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
usePrefixClass
@@ -0,0 +1,66 @@ | |||
import cx from 'classnames'; | |||
import React, { ComponentProps, FC, forwardRef, useImperativeHandle, useState } from 'react'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import type { FC } from "react"
类型建议这样引入
|
||
{{ customized }} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
以上内容应该存放在 tdeisgn-common 子仓库
|
||
{{ customized }} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同中文文档
import _DropdownMenu from './DropdownMenu'; | ||
|
||
import './style'; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
从./DropdownMenu, ./DropdownItem 模块中导出DropdownMenuProps 和DropdownItemProps 这两个类型定义
[keys, inputOptions], | ||
); | ||
|
||
const [id] = useState(uniqueId()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
用ref
const idRef = useRef(null)
if(!idRef.current){
idRef.current = uniqueId()
}
: {} | ||
} | ||
> | ||
{props.children ? ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
直接使用children就好,props.这个可以去掉,统一使用解构的值
)} | ||
</div> | ||
|
||
{footer ? footer : null} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TNode类型的使用parseTNode来渲染
🤔 这个 PR 的性质是?
🔗 相关 Issue
fix #392
💡 需求背景和解决方案
📝 更新日志
feat(DropdownMenu): 新增
DropdownMenu
组件本条 PR 不需要纳入 Changelog
☑️ 请求合并前的自查清单