|
@@ -1,4 +1,4 @@
|
1
|
|
-import React, { useEffect, useMemo, useState } from "react";
|
|
1
|
+import React, { useEffect, useMemo, useRef, useState } from "react";
|
2
|
2
|
import Taro, { useDidShow } from "@tarojs/taro";
|
3
|
3
|
import "./index.scss";
|
4
|
4
|
import { View, Text } from "@tarojs/components";
|
|
@@ -12,17 +12,15 @@ import IsLogin from "../../layout/IsLogin";
|
12
|
12
|
const account = props => {
|
13
|
13
|
const [list, setList] = useState([]);
|
14
|
14
|
const [page, setPage] = useState({ total: 0, pageNum: 0 });
|
|
15
|
+ const [height, setHeight] = useState(600)
|
15
|
16
|
const [loading, setLoading] = useState(false);
|
16
|
17
|
|
|
18
|
+ const layoutRef = useRef()
|
|
19
|
+
|
17
|
20
|
const radioHouseState = useMemo(() => props.radioHouseState, [
|
18
|
21
|
props.radioHouseState
|
19
|
22
|
]);
|
20
|
23
|
|
21
|
|
- console.log(props, radioHouseState);
|
22
|
|
- useEffect(() => {
|
23
|
|
-
|
24
|
|
- }, []);
|
25
|
|
-
|
26
|
24
|
useDidShow(() => {
|
27
|
25
|
getShopList({ pageNum: 1, pageSize: 10 });
|
28
|
26
|
// if(page.pageNum==1){
|
|
@@ -46,6 +44,11 @@ const account = props => {
|
46
|
44
|
}else {
|
47
|
45
|
setList(list.concat(records || []));
|
48
|
46
|
}
|
|
47
|
+
|
|
48
|
+ const t = setTimeout(() => {
|
|
49
|
+ setHeight(layoutRef.current.offsetHeight() - 10)
|
|
50
|
+ clearTimeout(t)
|
|
51
|
+ }, 500)
|
49
|
52
|
|
50
|
53
|
})
|
51
|
54
|
.catch(() => setLoading(false));
|
|
@@ -107,11 +110,11 @@ const account = props => {
|
107
|
110
|
return (
|
108
|
111
|
<IsLogin>
|
109
|
112
|
<View className="account">
|
110
|
|
- <Layout>
|
|
113
|
+ <Layout ref={layoutRef}>
|
111
|
114
|
<InifiniteList
|
112
|
115
|
length={list.length}
|
113
|
116
|
total={page.total}
|
114
|
|
- height={600}
|
|
117
|
+ height={height}
|
115
|
118
|
itemRenderer={renderItem}
|
116
|
119
|
loadMore={loadMore}
|
117
|
120
|
/>
|