摘要: css modules通过对css类名重命名 保证每个类名的唯一性 从而避免样式冲突的问题 换句话:所有类名就具有局部作用域 只能当前组件内部生效 webpack的css-loader原因 阅读全文
posted @ 2022-06-01 20:59 前端导师歌谣 阅读(21) 评论(0) 推荐(0)
摘要: 1.3组件间样式覆盖问题 1css in js css in js:是使用javascript编写css的统称 用来解决css样式冲突 推荐使用:css modules 阅读全文
posted @ 2022-06-01 20:59 前端导师歌谣 阅读(36) 评论(0) 推荐(0)
摘要: 1cityList组件的样式 会影响Map组件的样式 2在配置路由时候 cityList和map组件都被导入到项目中 那么组件的样式也被导入到项目之中 了 如果组件之间样式名称相同 那么一个组件中的样式就会在另一个组件中中生效 从而造成组件样式之间相互覆盖的问题 3只要导入了组件 不管组件中有没有显 阅读全文
posted @ 2022-06-01 20:59 前端导师歌谣 阅读(20) 评论(0) 推荐(0)
摘要: import React from 'react' import axios from 'axios' //导入axios //导入navBar组件 import { NavBar, Icon, Toast } from 'antd-mobile' import './index.scss' imp 阅读全文
posted @ 2022-06-01 20:59 前端导师歌谣 阅读(59) 评论(0) 推荐(0)
摘要: 添加props校验 导入propTypes import React from 'react' import { NavBar } from 'antd-mobile' // 导入 withRouter 高阶组件 import { withRouter } from 'react-router-do 阅读全文
posted @ 2022-06-01 20:59 前端导师歌谣 阅读(35) 评论(0) 推荐(0)
摘要: import React from 'react' import { NavBar } from 'antd-mobile' // 导入 withRouter 高阶组件 import { withRouter } from 'react-router-dom' import "./index.scs 阅读全文
posted @ 2022-06-01 20:59 前端导师歌谣 阅读(29) 评论(0) 推荐(0)
摘要: .navbar { // 组件应该保持默认的基本样式,对于页面单独需要的样式,在页面中单独指定就可以了 // margin-top: -45px; color: #333; background-color: #f6f5f6; .am-navbar-title { color: #333; } } 阅读全文
posted @ 2022-06-01 20:59 前端导师歌谣 阅读(26) 评论(0) 推荐(0)
摘要: 1封装NavHeader组件实现城市选择 地图找房页面的复用 2在component目录中创建NavHeader/index.js import React from 'react' import { NavBar } from 'antd-mobile' export default functi 阅读全文
posted @ 2022-06-01 20:59 前端导师歌谣 阅读(32) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2022-06-01 20:59 前端导师歌谣 阅读(29) 评论(0) 推荐(0)
摘要: 1给索引列表绑定点击事件 2在点击事件中 通过index获取到当前项索引号 3调用list组件的scrollToRow方法 让list组件滚动到指定行 4设置list的scrollToAlignment为start对准 import React from 'react' import axios f 阅读全文
posted @ 2022-06-01 20:59 前端导师歌谣 阅读(44) 评论(0) 推荐(0)