Commit f124542a authored by 熊成伟's avatar 熊成伟

debug

parent c36fc4a1
This diff is collapsed.
......@@ -4,7 +4,8 @@ import TodoCard from '../../components/LogCard'
import TopSearch from '../../components/TopSearch'
const Backlog = (props) => {
const [current, setCurrent] = useState()
const [current, setCurrent] = useState(1);
const [searchWord, setSearchWord] = useState()
const [loading, setLoading] = useState(false);
......@@ -13,6 +14,13 @@ const Backlog = (props) => {
const checkLog = () => {
props.history.push(`/blank/info/example/1`)
};
const getData = () => {
setLoading(false)
const pageMap ={searchWord, nowPage: current, pageSize: 10}
let result = data.concat([{}, {}, {}, {}, {}, {}])
setData(result)
setCurrent(current + 1)
};
//下拉加载
const handleScroll = () => {
......@@ -20,15 +28,19 @@ const Backlog = (props) => {
const top = event.scrollTop;
const scrollHeight = event.scrollHeight;
const clientHeight = event.clientHeight;
console.log(top, scrollHeight, clientHeight);
if (top + clientHeight === scrollHeight) {
setData([...data, {}, {}, {}, {}, {}, {}])
// setCurrent(current + 1)
setLoading(true);
getData()
}
};
useEffect(() => {
window.addEventListener('scroll', handleScroll, true);
return () => window.removeEventListener('scroll', handleScroll, true);
}, [data]);
useEffect(() => {
const element = document.getElementById('common-content')
element.scrollTo(0, 0)
}, [])
return (
......@@ -39,7 +51,7 @@ const Backlog = (props) => {
animating={loading}
/>
<WhiteSpace/>
<TopSearch onSearch={val => console.log(val)}/>
<TopSearch onSearch={setSearchWord}/>
{
data.map((item, index) => (
<div key={index}>
......
import React, {useState} from 'react';
import React, {useEffect, useState} from 'react';
import {ActivityIndicator, WhiteSpace, WingBlank} from 'antd-mobile'
import TodoCard from '../../components/LogCard'
import TopNotice from '../../components/NoticeTab'
const Notice = (props) => {
const [loading, setLoading] = useState(false)
const [loading, setLoading] = useState(false);
const [current, setCurrent] = useState(1);
const [searchWord, setSearchWord] = useState()
const [data, setData] = useState([{},{},{},{},{},{}]);
const getData = () => {
setLoading(false)
const pageMap ={searchWord, nowPage: current, pageSize: 10}
let result = data.concat([{}, {}, {}, {}, {}, {}])
setData(result)
setCurrent(current + 1)
};
//下拉加载
const handleScroll = () => {
const event = document.getElementById("common-content")
const top = event.scrollTop;
const scrollHeight = event.scrollHeight;
const clientHeight = event.clientHeight;
if (top + clientHeight === scrollHeight) {
setLoading(true);
getData()
}
};
useEffect(() => {
window.addEventListener('scroll', handleScroll, true);
return () => window.removeEventListener('scroll', handleScroll, true);
}, [data]);
const checkLog = () => {
props.history.push(`/blank/info/example/1`)
};
return (
<WingBlank>
<ActivityIndicator
......@@ -15,8 +46,15 @@ const Notice = (props) => {
/>
<WhiteSpace/>
<TopNotice/>
{
data.map((item, index) => (
<div key={index}>
<WhiteSpace/>
<TodoCard/>
<TodoCard data={item} onClick={checkLog}/>
</div>
))
}
</WingBlank>
);
};
......
......@@ -31,21 +31,6 @@ const Work = () => {
// index > -1 && arr.splice(index, 1);
};
//测试数据
const data222 = Array.from(new Array(7)).map((_val, i) => ({
id: `name${i}`,
icon: '/img/test/test.png',
text: `name${i}`,
}));
const data22222 = Array.from(new Array(7)).map((_val, i) => ({
id: `name2${i}`,
icon: '/img/test/test-1.png',
text: `name${i}`,
}));
console.log(data);
return (
<WingBlank>
<ActivityIndicator
......@@ -56,15 +41,6 @@ const Work = () => {
<WhiteSpace/>
<TopSearch onSearch={ workSearch }/>
<WhiteSpace/>
<WorkCard
type="edit"
title="常用板块"
addCommon={ commonEdit }
addStatus={addStatus}
data={data222}
iconAction={ itemSlice }
/>
<WhiteSpace/>
<WorkCard
title="事物管理"
addCommon={ commonEdit }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment