提交 b60f961c authored 作者: 王绍森's avatar 王绍森

ListViewDiy组件修改

上级 9b7e659b
.listWrapper { .listWrapper {
height: 100%;
:global { :global {
.am-list-body { .am-list-body {
background-color: transparent; background-color: transparent;
......
...@@ -14,6 +14,7 @@ import styles from './ListViewDiy.less'; ...@@ -14,6 +14,7 @@ import styles from './ListViewDiy.less';
// mountedSearch: 页面加载后是否查询 // mountedSearch: 页面加载后是否查询
// ListSeparator: ListView组件的ListSeparator // ListSeparator: ListView组件的ListSeparator
// NoResult: 搜索结果为空时显示的内容 // NoResult: 搜索结果为空时显示的内容
// responseCallback: 搜索结果回调函数
export class ListViewDiy extends Component { export class ListViewDiy extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
...@@ -58,7 +59,7 @@ export class ListViewDiy extends Component { ...@@ -58,7 +59,7 @@ export class ListViewDiy extends Component {
}) })
queryData = (isRefresh = true) => { queryData = (isRefresh = true) => {
const { searchValues, } = this.props; const { searchValues, responseCallback, } = this.props;
const { isLoading, isRefreshing, hasNextPage, pageSize, pageNo, } = this.state; const { isLoading, isRefreshing, hasNextPage, pageSize, pageNo, } = this.state;
if (isLoading || isRefreshing || (!isRefresh && !hasNextPage)) return; if (isLoading || isRefreshing || (!isRefresh && !hasNextPage)) return;
...@@ -84,7 +85,8 @@ export class ListViewDiy extends Component { ...@@ -84,7 +85,8 @@ export class ListViewDiy extends Component {
hasNextPage, hasNextPage,
hasSearched: true, hasSearched: true,
}; };
}) });
responseCallback && responseCallback(res,)
} }
}).finally(() => { }).finally(() => {
this.setState({ isLoading: false, isRefreshing: false, }); this.setState({ isLoading: false, isRefreshing: false, });
...@@ -92,7 +94,7 @@ export class ListViewDiy extends Component { ...@@ -92,7 +94,7 @@ export class ListViewDiy extends Component {
} }
onEndReached = (event) => { onEndReached = (event) => {
this.setState(({ pageNo }) => ({ pageNo: pageNo + 1}), this.queryData(false)); this.setState(({ pageNo }) => ({ pageNo: pageNo + 1}), () => this.queryData(false));
} }
render() { render() {
...@@ -123,7 +125,7 @@ export class ListViewDiy extends Component { ...@@ -123,7 +125,7 @@ export class ListViewDiy extends Component {
initialListSize={pageSize} initialListSize={pageSize}
onEndReachedThreshold={10} onEndReachedThreshold={10}
style={{ style={{
height, height: '100%',
overflow: 'scroll', overflow: 'scroll',
}} }}
/> />
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论