課程
/前端開(kāi)發(fā)
/HTML/CSS
/DatePicker組件開(kāi)發(fā)
不會(huì)寫(xiě)呀,日歷不對(duì)
2017-05-27
源自:DatePicker組件開(kāi)發(fā) 5-3
正在回答
if(direction === 'prev'){
? ? ? ? ? ? if(month <= 1){
? ? ? ? ? ? ? ? console.log('ppp')
? ? ? ? ? ? ? ? month =12
? ? ? ? ? ? ? ? year--
? ? ? ? ? ? }else{
? ? ? ? ? ? ? ? month--
? ? ? ? ? ? }
? ? ? ? }
? ? ? ? if(direction === 'next'){
? ? ? ? ? ? if(month >11){
? ? ? ? ? ? ? ? month =1
? ? ? ? ? ? ? ? year++
? ? ? ? ? ? ? ? month++
渲染部分可以這么寫(xiě)
切換上一月時(shí),可以這樣寫(xiě):
if(direction === 'prev') {
? month--;
? if(month === 0){
? month = 12;
? year--;
? }
舉報(bào)
使用原生JS完成一個(gè)日期選擇器(datepicker)組件的開(kāi)發(fā)
1 回答切換月份的問(wèn)題
3 回答關(guān)于月份切換時(shí),日歷會(huì)關(guān)閉的問(wèn)題
1 回答年份 是不是 有問(wèn)題 點(diǎn)左邊的 一直點(diǎn) 不能到去年的
3 回答為什么我的代碼第一次可以渲染本地的時(shí)間出來(lái),當(dāng)我點(diǎn)擊上個(gè)月和下個(gè)月的按鈕時(shí)?
1 回答怎么給當(dāng)前日期在頁(yè)面上添加不同顏色
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號(hào)-11 京公網(wǎng)安備11010802030151號(hào)
購(gòu)課補(bǔ)貼聯(lián)系客服咨詢(xún)優(yōu)惠詳情
慕課網(wǎng)APP您的移動(dòng)學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號(hào)
2018-07-27
if(direction === 'prev'){
? ? ? ? ? ? if(month <= 1){
? ? ? ? ? ? ? ? console.log('ppp')
? ? ? ? ? ? ? ? month =12
? ? ? ? ? ? ? ? year--
? ? ? ? ? ? }else{
? ? ? ? ? ? ? ? month--
? ? ? ? ? ? }
? ? ? ? }
? ? ? ? if(direction === 'next'){
? ? ? ? ? ? if(month >11){
? ? ? ? ? ? ? ? month =1
? ? ? ? ? ? ? ? year++
? ? ? ? ? ? }else{
? ? ? ? ? ? ? ? month++
? ? ? ? ? ? }
? ? ? ? }
渲染部分可以這么寫(xiě)
2017-05-28
切換上一月時(shí),可以這樣寫(xiě):
if(direction === 'prev') {
? month--;
? if(month === 0){
? month = 12;
? year--;
? }
? }