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
运行结果