This commit is contained in:
HuaYu 2023-02-14 20:20:18 +08:00
parent 41ad91a89d
commit 9e7996c617
7 changed files with 43 additions and 6 deletions

View File

@ -0,0 +1,4 @@
.navbar {
color: #333;
background-color: #f6f5f6;
}

View File

@ -0,0 +1,16 @@
import React from "react";
import { NavBar } from "antd-mobile";
import { useNavigate } from "react-router-dom";
import PropTypes from 'prop-types'
import styles from './index.module.css'
export default function NavHeader({children,back}){
const defaultHandler =()=>navigate(-1);
const navigate = useNavigate();
return (<NavBar className={styles.NavBar} back='返回' onBack={back||defaultHandler} >{children}</NavBar>)
}
// 添加校验
NavHeader.propTypes={
children:PropTypes.string.isRequired,
back:PropTypes.func
}
// export default withRouter(NavHeader)

View File

@ -0,0 +1,8 @@
.navbar {
color: #333;
background-color: #f6f5f6;
}
/* 全局类型处理 */
.navbar :global(.am-navbar-title){
color: #333;
}

View File

@ -1,10 +1,6 @@
.citylist{ .citylist{
height: 100%; height: 100%;
padding-top: 45px; /* padding-top: 45px; */
}
.citylist-navbar {
background: #f6f5f6;
margin-top: -45px;
} }
ul{ ul{
list-style: none; list-style: none;

View File

@ -6,6 +6,9 @@ import axios from "axios";
import { getCurrentCity } from "../../utils"; import { getCurrentCity } from "../../utils";
import { List, AutoSizer } from "react-virtualized"; import { List, AutoSizer } from "react-virtualized";
import WidthUseNavigate from "../WidthUseNavigate"; import WidthUseNavigate from "../WidthUseNavigate";
import NavHeader from "../../components/NavHeader";
import styles from './index.module.css'
console.log(styles)
// list:[{},{}] // list:[{},{}]
const formatCityIndex = (letter) => { const formatCityIndex = (letter) => {
switch (letter) { switch (letter) {
@ -165,7 +168,7 @@ class CityListInner extends React.Component {
} }
render() { render() {
return <div className="citylist"><NavBar className="citylist-navbar" back='返回' onBack={back}>城市选择</NavBar> return <div className="citylist"><NavHeader>城市选择</NavHeader>
<AutoSizer> <AutoSizer>
{({ width, height }) => ( {({ width, height }) => (
<List <List

View File

View File

@ -0,0 +1,10 @@
.map{
padding-top: 45px;
height: 100%;
}
.container{
height: 100%;
}
.map :global(.adm-nav-bar){
margin-top: -45px;
}