Coder Social home page Coder Social logo

jdf2e / nutui-react Goto Github PK

View Code? Open in Web Editor NEW
843.0 16.0 252.0 41.54 MB

京东风格的移动端 React 组件库 、支持多端小程序(A React UI Toolkit for Mobile Web)

Home Page: https://nutui.jd.com/react/

JavaScript 3.55% Shell 0.01% HTML 5.13% SCSS 11.20% TypeScript 79.26% CSS 0.86%
typescript react-components ui-library ui-kit nutui-react

nutui-react's Issues

Infiniteloading里的loadMore方法,当props更新的时候,loadMore方法取不到最新的props值,需要第二次执行才能取到。

const refreshLoadMore = (done: () => void) => {
setTimeout(() => {
const { newValue } = props; // 假设这个newValue 是该父组件传过来的值,且中途有修改。则需要执行到第二次refreshLoadMore ,newValue 才能取到修改之后的值
const curLen = refreshList.length
for (let i = curLen; i < curLen + 10; i++) {
refreshList.push(${i})
}
if (refreshList.length >= 30) {
setRefreshHasMore(false)
} else {
setRefreshList([...refreshList])
}
done()
}, 500)
}

dialog弹窗组件希望增加点击弹窗本身抛出事件

dialog弹窗组件希望增加点击弹窗本身抛出事件

`<Dialog
title="组件调用"
visible={visible1}
onOk={() => setVisible1(false)}
onCancel={() => setVisible1(false)}
onClick={()=>{}}

如果需要在弹窗内嵌入组件或其他自定义内容,可以使用组件调用的方式。
`

react nutui component textarea bind Value not work

example:
const [content, setContent] = useState('')

<TextArea className='textarea' defaultValue={content} onChange={(e) => { console.log('e', e) }} limitShow maxlength='20' /> change value 123 console.log('content', content) => ''

希望每个组件的Props类型能export出去

在原组件上进行业务组件开发时,需要继承原组件的props类型,没法直接通过
import { Icon, IconProps } from '@nutui/nutui-react'

目前只能通过

type IconProps = typeof Icon.defaultProps

这样不友好的方便来获取,感觉代码不够美观

Calendar 开始时间无效

Calendar 开始时间无效

packages.json
image

代码:
image

结果:(无法向上滚动,查看更多数据)
image

Popup 组件体验问题

  1. 没有设置最大宽度/高度
  2. 调整x号样式,需要修改的属性太多,建议优化。

支持taro

我看vue版本是支持taro的,react版本后期会支持taro吗

npm run dev 时报错

npm run dev 时报错

Big integer literals are not available in the configured target environment ("chrome87", "edge88", "es2019", "firefox78", "safari13.1")

image

根据条件动态渲染不同页面时出现页面不停刷新 抖动的情况

不确定是不是我自己的开发问题,因为刚开始学习和使用react四天时间,还有些生疏,问题是这样的
在渲染列表页的时候,根据不同的情况,如果列表没有数据,则渲染,否则渲染正常的
在return()里使用了{!bool && } ,bool = useState, MyEmpty自定义,{bool&&},同样MyCard自定义,
此时在 MyCard 里面有一个 元素,例如,在获取change事件后,更新 useState时,会不停的重新渲染整个页面,此时页面会出现抖动的情况,如果将MyCard里的元素全部直接写到return()里,则不会出现此情况。
问题就是这样,感谢大佬们的支持。

Upload 上传非图片格式时期望增加自定义图片的配置

Upload 默认使用时(非自定义)如果上传非图片格式,显示一片空白,查看源码,只有上传图片才显示img标签。

期望上传 pdf/word/ppt 等格式的文件时,能自定义配置要展示的默认图片,需要暴漏出一个 props。

官网 babel 按需加载例子缺少 引入 sass varibale

问题

nutui-react 官网「快速上手」一节介绍 WebPack 构建工具 通过 babel 使用按需加载 有误
仅配置 babel-plugin-import 无法正常运行

报错如下

Failed to compile.

SassError: Undefined variable.
  ╷
5 │   width: $icon-width;
  │          ^^^^^^^^^^^
  ╵
  node_modules/@nutui/nutui-react/dist/packages/icon/icon.scss 5:10  root stylesheet
ERROR in ./node_modules/@nutui/nutui-react/dist/packages/icon/icon.scss (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[7].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[7].use[2]!./node_modules/resolve-url-loader/index.js??ruleSet[1].rules[1].oneOf[7].use[3]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[7].use[4]!./node_modules/@nutui/nutui-react/dist/packages/icon/icon.scss)
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: Undefined variable.
  ╷
5 │   width: $icon-width;
  │          ^^^^^^^^^^^
  ╵
  node_modules/@nutui/nutui-react/dist/packages/icon/icon.scss 5:10  root stylesheet

后续发现,@nutui/nutui-react 导出的 sass 文件包含 sass variable 但是未引入对应 sass variable 文件,实际配置还需要借助 sass-resources-loader 全局导入 sass variable 文件

可复现demo

https://stackblitz.com/edit/webpack-webpack-js-org-bmddyc

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.