添加返回上一步

This commit is contained in:
HuaYu 2023-01-28 20:33:56 +08:00
parent 95459b659a
commit e8fba65f81
2 changed files with 59 additions and 4 deletions

50
.idea/workspace.xml Normal file
View File

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="c22c6a78-950d-4bff-ac7a-ed800fcbb7de" name="Changes" comment="" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="MarkdownSettingsMigration">
<option name="stateVersion" value="1" />
</component>
<component name="ProjectId" id="2KWNUOdtRQIUIJvVRsdpzzM23Bg" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"RunOnceActivity.OpenProjectViewOnStart": "true",
"RunOnceActivity.ShowReadmeOnStart": "true",
"last_opened_file_path": "D:/workspace/hkzf-mobile"
}
}]]></component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="c22c6a78-950d-4bff-ac7a-ed800fcbb7de" name="Changes" comment="" />
<created>1674086393783</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1674086393783</updated>
</task>
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State />
</value>
</entry>
</map>
</option>
</component>
</project>

View File

@ -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 = () => { }
// </div>
// );
// }
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 {
<ul className="city-index">{this.renderCityIndex()}</ul>
</div>
}
}
}
// 使用高阶组件包裹当前类组件
const CityList = WidthUseNavigate(CityListInner);
export default CityList