From e8fba65f8199245405a058386fcd13ef5ff5ecc8 Mon Sep 17 00:00:00 2001 From: HuaYu <15600557119@163.com> Date: Sat, 28 Jan 2023 20:33:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=BF=94=E5=9B=9E=E4=B8=8A?= =?UTF-8?q?=E4=B8=80=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/workspace.xml | 50 +++++++++++++++++++++++++++++++++++++ src/pages/CityList/index.js | 13 +++++++--- 2 files changed, 59 insertions(+), 4 deletions(-) create mode 100644 .idea/workspace.xml diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..0a30445 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + 1674086393783 + + + + + + + \ No newline at end of file diff --git a/src/pages/CityList/index.js b/src/pages/CityList/index.js index 01decba..91138ec 100644 --- a/src/pages/CityList/index.js +++ b/src/pages/CityList/index.js @@ -5,6 +5,7 @@ import './index.css' import axios from "axios"; import { getCurrentCity } from "../../utils"; import { List, AutoSizer } from "react-virtualized"; +import WidthUseNavigate from "../WidthUseNavigate"; // list:[{},{}] const formatCityIndex = (letter) => { switch (letter) { @@ -71,7 +72,7 @@ const back = () => { } // // ); // } -export default class CityList extends React.Component { +class CityListInner extends React.Component { constructor(props){ super(props) @@ -155,9 +156,9 @@ export default class CityList extends React.Component { } changeCity({label,value}){ if(HOUSE_CITY.indexOf(label)>-1){ - localStorage.setItem('hkzf_city',JSON.stringify({label,value})) + localStorage.setItem('local_city',JSON.stringify({label,value})) // 返回上一个页面 - + this.props.to(-1) }else{ Toast.show('该城市暂无房源数据') } @@ -181,4 +182,8 @@ export default class CityList extends React.Component { } -} \ No newline at end of file +} + +// 使用高阶组件包裹当前类组件 +const CityList = WidthUseNavigate(CityListInner); +export default CityList \ No newline at end of file