We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
@nutui/nutui-react
"@nutui/nutui-react-taro": "^2.0.15",
weapp
https://nutui.jd.com/taro/react/2x/#/zh-CN/component/infiniteloading
import React, { useState, useEffect } from 'react' import Taro from '@tarojs/taro' import { Jd } from '@nutui/icons-react-taro' import { Cell, InfiniteLoading } from '@nutui/nutui-react-taro'
const sleep = (time: number): Promise => new Promise((resolve) => {setTimeout(resolve, time)}) const InfiniteUlStyle = { height: '500px', width: '100%', padding: '0', overflowY: 'auto', overflowX: 'hidden', }
const InfiniteLiStyle = { marginTop: '10px', fontSize: '14px', color: 'rgba(100, 100, 100, 1)', textAlign: 'center', } const App = () => { const [defaultList, setDefaultList] = useState<string[]>([]) const [hasMore, setHasMore] = useState(true)
useEffect(() => { init() }, [])
const loadMore = async () => { await sleep(2000) const curLen = defaultList.length for (let i = curLen; i < curLen + 10; i++) { defaultList.push(${i}) } if (defaultList.length >= 30) { setHasMore(false) } else { setDefaultList([...defaultList]) } }
${i}
const refresh = async () => { await sleep(1000) Taro.showToast({ title: '刷新成功', icon: 'success', duration: 2000, }) }
const init = () => { for (let i = 0; i < 20; i++) { defaultList.push(${i}) } setDefaultList([...defaultList]) }
return ( <>
能够正常显示没有更多数据
直接使用官网提供的demo就能复现,下拉到最后依然显示加载中,不会显示加载完成
Taro v3.6.20
"dependencies": { "@babel/runtime": "^7.7.7", "@nutui/nutui-react-taro": "^2.0.15", "@tarojs/components": "3.6.20", "@tarojs/helper": "3.6.20", "@tarojs/plugin-framework-react": "3.6.20", "@tarojs/plugin-html": "3.6.20", "@tarojs/plugin-platform-alipay": "3.6.20", "@tarojs/plugin-platform-h5": "3.6.20", "@tarojs/plugin-platform-jd": "3.6.20", "@tarojs/plugin-platform-qq": "3.6.20", "@tarojs/plugin-platform-swan": "3.6.20", "@tarojs/plugin-platform-tt": "3.6.20", "@tarojs/plugin-platform-weapp": "3.6.20", "@tarojs/react": "3.6.20", "@tarojs/runtime": "3.6.20", "@tarojs/shared": "3.6.20", "@tarojs/taro": "3.6.20", "react": "^18.0.0", "react-dom": "^18.0.0", "react-refresh": "^0.11.0", "recoil": "^0.7.7" },
The text was updated successfully, but these errors were encountered:
可尝试升级到 2.3.4 版本,
Sorry, something went wrong.
No branches or pull requests
NutUI React 包名
@nutui/nutui-react
NutUI React 版本号
"@nutui/nutui-react-taro": "^2.0.15",
平台
weapp
重现链接
https://nutui.jd.com/taro/react/2x/#/zh-CN/component/infiniteloading
重现步骤
import React, { useState, useEffect } from 'react'
import Taro from '@tarojs/taro'
import { Jd } from '@nutui/icons-react-taro'
import { Cell, InfiniteLoading } from '@nutui/nutui-react-taro'
const sleep = (time: number): Promise =>
new Promise((resolve) => {setTimeout(resolve, time)})
const InfiniteUlStyle = {
height: '500px',
width: '100%',
padding: '0',
overflowY: 'auto',
overflowX: 'hidden',
}
const InfiniteLiStyle = {
marginTop: '10px',
fontSize: '14px',
color: 'rgba(100, 100, 100, 1)',
textAlign: 'center',
}
const App = () => {
const [defaultList, setDefaultList] = useState<string[]>([])
const [hasMore, setHasMore] = useState(true)
useEffect(() => {
init()
}, [])
const loadMore = async () => {
await sleep(2000)
const curLen = defaultList.length
for (let i = curLen; i < curLen + 10; i++) {
defaultList.push(
${i}
)}
if (defaultList.length >= 30) {
setHasMore(false)
} else {
setDefaultList([...defaultList])
}
}
const refresh = async () => {
await sleep(1000)
Taro.showToast({
title: '刷新成功',
icon: 'success',
duration: 2000,
})
}
const init = () => {
for (let i = 0; i < 20; i++) {
defaultList.push(
${i}
)}
setDefaultList([...defaultList])
}
return (
<>
基础用法
<InfiniteLoading
pullingText={
<>
松开刷新
</>
}
loadingText={
<>
加载中
</>
}
loadMoreText={
<>
没有更多了
</>
}
pullRefresh
target="scrollDemo"
hasMore={hasMore}
onLoadMore={loadMore}
onRefresh={refresh}
>
{defaultList.map((item, index) => {
return (
{item}
)
})}
</>
)
}
export default App
期望的结果是什么?
能够正常显示没有更多数据
实际的结果是什么?
直接使用官网提供的demo就能复现,下拉到最后依然显示加载中,不会显示加载完成
环境信息
Taro v3.6.20
其他补充信息
"dependencies": {
"@babel/runtime": "^7.7.7",
"@nutui/nutui-react-taro": "^2.0.15",
"@tarojs/components": "3.6.20",
"@tarojs/helper": "3.6.20",
"@tarojs/plugin-framework-react": "3.6.20",
"@tarojs/plugin-html": "3.6.20",
"@tarojs/plugin-platform-alipay": "3.6.20",
"@tarojs/plugin-platform-h5": "3.6.20",
"@tarojs/plugin-platform-jd": "3.6.20",
"@tarojs/plugin-platform-qq": "3.6.20",
"@tarojs/plugin-platform-swan": "3.6.20",
"@tarojs/plugin-platform-tt": "3.6.20",
"@tarojs/plugin-platform-weapp": "3.6.20",
"@tarojs/react": "3.6.20",
"@tarojs/runtime": "3.6.20",
"@tarojs/shared": "3.6.20",
"@tarojs/taro": "3.6.20",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-refresh": "^0.11.0",
"recoil": "^0.7.7"
},
The text was updated successfully, but these errors were encountered: