Skip to content
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

[alert] 未导出Props类型 #972

Closed
albyben opened this issue Nov 27, 2024 · 0 comments
Closed

[alert] 未导出Props类型 #972

albyben opened this issue Nov 27, 2024 · 0 comments
Labels
bug Something isn't working typescript

Comments

@albyben
Copy link
Collaborator

albyben commented Nov 27, 2024

重现链接或代码

import { useState } from 'react'
import ReactDOM from 'react-dom'
import { Radio, Input } from '@kdcloudjs/kdesign'

const Demo: React.FC = () => {
  type Itype = Exclude<IAlertProps['type'], undefined>
  const [delayTime, setDelayTime] = React.useState<IAlertProps['delayOffTime']>(0)
  const ref = React.useRef<HTMLInputElement>(null)
  const map = {
    success: '成功提示',
    warning: '警告提示',
    error: '错误提示',
    info: '信息通知',
  }
  const getMessage = (type: Itype) => {
    return `这是${map[type]}类型的反馈浮层`
  }
  const demoButtonStyle = { margin: '0px 8px 8px 0' }
  const inputStyle = { marginBottom: 8, marginRight: 8, width: 230 }
  const handleTimeClick = () => {
    ref.current && setDelayTime((!isNaN(+ref.current.value) && +ref.current.value) || 0)
  }
  return (
    <>
      <InputNumber
        ref={ref}
        style={inputStyle}
        placeholder="反馈浮层消息持续时间, ms为单位"
        digitLength={5}
        defaultValue={'1000'}
      />
      <Button type="primary" style={demoButtonStyle} onClick={handleTimeClick}>
        设置反馈浮层消息持续时间
      </Button>
      {Object.keys(map).map((type: Itype) => {
        return <Alert key={type} message={getMessage(type)} type={type} delayOffTime={delayTime} />
      })}
    </>
  )
}

ReactDOM.render(<Demo />, mountNode)

重现问题步骤

期望的结果是什么

实际的结果是什么

组件库版本号、浏览器信息

组件库与浏览器均为最新版本

@albyben albyben added the bug Something isn't working label Nov 27, 2024
albyben pushed a commit to albyben/kdesign that referenced this issue Nov 27, 2024
albyben pushed a commit to albyben/kdesign that referenced this issue Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working typescript
Projects
None yet
Development

No branches or pull requests

1 participant