2020.11.18 頁面修改後,重新整理或離開會彈出確定框 DatePicker 不能選中當前之前的時間 以及一些可以看的資料【堆疊開始……
阿新 • • 發佈:2020-12-11
https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault
https://www.cnblogs.com/kunmomo/p/10183364.html
https://bbs.csdn.net/topics/392273393
-
以上為彈窗是否要離開/是否要重新整理
-
date物件相減
-
設定彈窗出現間隔,使用localStorage
https://blog.csdn.net/fcdd123/article/details/56286106
https://www.cnblogs.com/princeness/p/11664922.html
https://developer.mozilla.org/zh-CN/docs/Web/API/Storage/setItem
- 小紅點要實時重新整理,所以用了hox的全域性狀態管理;彈窗是通過mount時間決定是否載入,所以不需要實時更新。
https://github.com/umijs/hox/blob/master/README-cn.md
- DatePicker不能選中當前之前的時間,回撥函式中current引數(date)是實時更新的,可以用它來獲取當前已經選擇了的時間。
function disableDate(current){ return current && current < moment().startOf('day'); } function disabledDateTime(current) { let date = new Date() let day = date.getDate();//今天的日期 let hour = date.getHours();//當前的小時 let min = date.getMinutes();//當前分鐘 let chosenDate, chosenDay, chosenHour; if(current) { chosenDate = current.toDate();//選中的時間 chosenDay = chosenDate.getDate();//選中的日期 chosenHour = chosenDate.getHours();//選中的小時 } const disabledHours = ()=>{ if(chosenDay === day){ return range(0, hour) } } const disabledMinutes = ()=>{ if(chosenDay === day && chosenHour === hour){ return range(0, min) } } return { disabledHours: disabledHours, disabledMinutes: disabledMinutes, } }
- import Page from '......'和import {Page} from '......'
- 做瀑布流的效果
先做,沒有問題了就去請求,
先了解現在的problem是怎麼做的:
function useProblemSet(token) {
const [isLoading, setLoading] = useState(true);
const [filterTags, setFilterTags] = useState({});
const [queryTags, setQueryTags] = useState([]);
const [pool, setPool] = useState([]);
相關部落格、資料: