0
点赞
收藏
分享

微信扫一扫

好客租房133-获取并处理城市列表数据

求阙者 2022-05-31 阅读 199

 1获取步骤

import React from 'react'
import axios from "axios"
//导入axios
//导入navBar组件
import { NavBar, Icon } from 'antd-mobile'
import "./index.scss"
class cityList extends React.Component {
componentDidMount(){
this.getCityList()
}
async getCityList(){
const res = await axios.get('http://localhost:8080/area/city?level=1')
}
render() {
return (
<div className='citylist'>
<NavBar className='navbar'
mode="light"
icon={<i className='iconfont icon-back' />}
onLeftClick={() => this.props.histoty.push.go(-1)}
// 导航栏右边内容
// rightContent={[
//
// key="0"
// type="search"
// style={{ marginRight: '16px' }}
// />,
// ,
// ]}
>
城市选择
</NavBar>
</div>
)
}
}

export default cityList

运行结果

好客租房133-获取并处理城市列表数据_导航栏


举报

相关推荐

0 条评论