最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

微信小程序?qū)崿F(xiàn)簡(jiǎn)單日歷效果

 更新時(shí)間:2022年08月29日 17:27:49   作者:別兇小晗.  
這篇文章主要為大家詳細(xì)介紹了微信小程序?qū)崿F(xiàn)簡(jiǎn)單日歷效果,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了微信小程序?qū)崿F(xiàn)日歷效果的具體代碼,供大家參考,具體內(nèi)容如下

效果:

wxml:

<!-- 日歷 -->
? ? ? ? <view class="myReport-calendar">
? ? ? ? ? ? <view class="img">
? ? ? ? ? ? ? ? <image mode="aspectFit" src="/imgs/calendar.png"></image>
? ? ? ? ? ? </view>
? ? ? ? ? ? <view class="calendar">
? ? ? ? ? ? ? ? <view class="selectDate">
? ? ? ? ? ? ? ? ? ? <view class="date-wrap">
? ? ? ? ? ? ? ? ? ? ? ? {{year}}年{{month}}月
? ? ? ? ? ? ? ? ? ? </view>
? ? ? ? ? ? ? ? </view>

? ? ? ? ? ? ? ? <view class="week">
? ? ? ? ? ? ? ? ? ? <block wx:for="{{weekArr}}" wx:for-index="index" wx:for-item="item" wx:key="key">
? ? ? ? ? ? ? ? ? ? ? ? <view>{{item}}</view>
? ? ? ? ? ? ? ? ? ? </block>
? ? ? ? ? ? ? ? </view>

? ? ? ? ? ? ? ? <view class="date-box">

? ? ? ? ? ? ? ? ? ? <block wx:for='{{dateArr}}' wx:key='key'>
? ? ? ? ? ? ? ? ? ? ? ? <view class='{{theDay == item.isToday ? "nowDay" : ""}}' data-key='{{item.isToday}}'>
? ? ? ? ? ? ? ? ? ? ? ? ? ? <view class='date-head' data-year='{{year}}' data-month='{{month}}'
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? data-datenum='{{item.dateNum}}'>
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? <view>{{item.dateNum}}</view>
? ? ? ? ? ? ? ? ? ? ? ? ? ? </view>
? ? ? ? ? ? ? ? ? ? ? ? </view>
? ? ? ? ? ? ? ? ? ? </block>
? ? ? ? ? ?</view>
? ? ?</view>
</view>

js:

// pages/report/report.js
Page({

? ? /**
? ? ?* 頁(yè)面的初始數(shù)據(jù)
? ? ?*/
? ? data: {
? ? ? ? ? ? ? ?year: 0,
? ? ? ? month: 0,
? ? ? ? weekArr: ['日', '一', '二', '三', '四', '五', '六'],
? ? ? ? dateArr: [],
? ? ? ? isToday: "",
? ? ? ? isTodayWeek: false,
? ? ? ? todayIndex: 0,
? ? ? ? theDay: "",
? ? ? ? index: '',
? ? ? ? signNum: '', //簽到數(shù)
? ? },
? ?dateInit: function (setYear, setMonth) {
? ? ? ? //全部時(shí)間的月份都是按0~11基準(zhǔn),顯示月份才+1
? ? ? ? let dateArr1 = []; //需要遍歷的日歷數(shù)組數(shù)據(jù)
? ? ? ? let arrLen = 0; //dateArr的數(shù)組長(zhǎng)度
? ? ? ? let now = setYear ? new Date(setYear, setMonth) : new Date();
? ? ? ? let year = setYear || now.getFullYear();
? ? ? ? let nextYear = 0;
? ? ? ? let month = setMonth || now.getMonth(); //沒(méi)有+1方便后面計(jì)算當(dāng)月總天數(shù)
? ? ? ? let nextMonth = (month + 1) > 11 ? 1 : (month + 1);
? ? ? ? let startWeek = new Date(year + '/' + (month + 1) + '/' + 1).getDay(); //目標(biāo)月1號(hào)對(duì)應(yīng)的星期
? ? ? ? let dayNums = new Date(year, nextMonth, 0).getDate(); //獲取目標(biāo)月有多少天
? ? ? ? let obj = {};
? ? ? ? let num = 0;
? ? ? ? if (month + 1 > 11) {
? ? ? ? ? ? nextYear = year + 1;
? ? ? ? ? ? dayNums = new Date(nextYear, nextMonth, 0).getDate();
? ? ? ? }
? ? ? ? arrLen = startWeek + dayNums;
? ? ? ? for (let i = 0; i < arrLen; i++) {
? ? ? ? ? ? if (i >= startWeek) {
? ? ? ? ? ? ? ? num = i - startWeek + 1;
? ? ? ? ? ? ? ? obj = {
? ? ? ? ? ? ? ? ? ? isToday: '' + year + (month + 1) + num,
? ? ? ? ? ? ? ? ? ? dateNum: num,
? ? ? ? ? ? ? ? ? ? weight: 5
? ? ? ? ? ? ? ? }
? ? ? ? ? ? } else {
? ? ? ? ? ? ? ? obj = {};
? ? ? ? ? ? }
? ? ? ? ? ? dateArr1[i] = obj;
? ? ? ? }
? ? ? ? this.setData({
? ? ? ? ? ? dateArr: dateArr1
? ? ? ? })
? ? ? ? let nowDate = new Date();
? ? ? ? let nowYear = nowDate.getFullYear();
? ? ? ? let nowMonth = nowDate.getMonth() + 1;
? ? ? ? let nowWeek = nowDate.getDay();
? ? ? ? let getYear = setYear || nowYear;
? ? ? ? let getMonth = setMonth >= 0 ? (setMonth + 1) : nowMonth;
? ? ? ? if (nowYear == getYear && nowMonth == getMonth) {
? ? ? ? ? ? this.setData({
? ? ? ? ? ? ? ? isTodayWeek: true,
? ? ? ? ? ? ? ? todayIndex: nowWeek
? ? ? ? ? ? })
? ? ? ? } else {
? ? ? ? ? ? this.setData({
? ? ? ? ? ? ? ? isTodayWeek: false,
? ? ? ? ? ? ? ? todayIndex: -1
? ? ? ? ? ? })
? ? ? ? }
? ? },
? ? /**
? ? ?* 生命周期函數(shù)--監(jiān)聽(tīng)頁(yè)面顯示
? ? ?*/
? ? onShow: function () {
? ? ? ? let now = new Date();
? ? ? ? let year = now.getFullYear();
? ? ? ? let month = now.getMonth() + 1;
? ? ? ? this.dateInit();
? ? ? ? this.setData({
? ? ? ? ? ? year: year,
? ? ? ? ? ? month: month,
? ? ? ? ? ? isToday: '' + year + month + now.getDate(),
? ? ? ? ? ? theDay: '' + year + month + now.getDate()
? ? ? ? })
? ? },
? ? /**
? ? ?* 生命周期函數(shù)--監(jiān)聽(tīng)頁(yè)面加載
? ? ?*/
? ? onLoad: function (options) {
? ? ? ??
? ? },

? ? /**
? ? ?* 生命周期函數(shù)--監(jiān)聽(tīng)頁(yè)面初次渲染完成
? ? ?*/
? ? onReady: function () {

? ? },

? ? /**
? ? ?* 生命周期函數(shù)--監(jiān)聽(tīng)頁(yè)面顯示
? ? ?*/
? ? onShow: function () {

? ? },

? ? /**
? ? ?* 生命周期函數(shù)--監(jiān)聽(tīng)頁(yè)面隱藏
? ? ?*/
? ? onHide: function () {

? ? },

? ? /**
? ? ?* 生命周期函數(shù)--監(jiān)聽(tīng)頁(yè)面卸載
? ? ?*/
? ? onUnload: function () {

? ? },

? ? /**
? ? ?* 頁(yè)面相關(guān)事件處理函數(shù)--監(jiān)聽(tīng)用戶下拉動(dòng)作
? ? ?*/
? ? onPullDownRefresh: function () {

? ? },

? ? /**
? ? ?* 頁(yè)面上拉觸底事件的處理函數(shù)
? ? ?*/
? ? onReachBottom: function () {

? ? },

? ? /**
? ? ?* 用戶點(diǎn)擊右上角分享
? ? ?*/
? ? onShareAppMessage: function () {

? ? }
})

wxss:

/* 日歷 */
.myReport-calendar {
? ? width: 100%;
? ? height: 700rpx;
? ? margin-top: 27rpx;
? ? margin-bottom: 40rpx;
? ? position: relative;
}

.calendar {
? ? position: absolute;
? ? top: 88rpx;
? ? left: 0;
? ? right: 0;
? ? bottom: 0;
? ? margin: 0 auto;
}

.today .day {
? ? width: 100%;
? ? height: 100%;
? ? margin: 0 auto;
? ? text-align: center;
}

.today text {
? ? display: block;
? ? width: 60rpx;
? ? text-align: center;
? ? line-height: 60rpx;
? ? color: #fff;
? ? background: #00c8be;
? ? border-radius: 100rpx;
}

.selectDate {
? ? padding-bottom: 20rpx;
? ? text-align: center;
}

.date-wrap {
? ? font-size: 32rpx;
? ? font-weight: 600;
? ? color: #232323;
}

.week {
? ? display: flex;
? ? align-items: center;
? ? justify-content: space-around;
? ? padding: 30rpx;
? ? color: #000000;
? ? font-weight: 400;
? ? font-size: 28rpx;
}

.date-box {
? ? font-size: 0;
? ? padding: 0 30rpx 30rpx 30rpx;?
? ? margin: 0 auto;
}

.date-box>view {
? ? position: relative;
? ? display: inline-block;
? ? width: 14.285%;
? ? color: #333;
? ? text-align: center;
? ? vertical-align: middle;
? ? padding-bottom: 30rpx;
}

.date-head {
? ? height: 60rpx;
? ? line-height: 60rpx;
? ? font-size: 28rpx;
}

.nowDay .date-head {
? ? width: 60rpx;
? ? border-radius: 50%;
? ? text-align: center;
? ? color: #fff;
? ? background-color: #00c8be;
? ? margin: 0 auto;
}

.nowDay .date-head:hover {
? ? background: linear-gradient(to bottom right, #009899, #19d6cb);
}

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • JS實(shí)現(xiàn)點(diǎn)擊鏈接切換顯示隱藏內(nèi)容的方法

    JS實(shí)現(xiàn)點(diǎn)擊鏈接切換顯示隱藏內(nèi)容的方法

    這篇文章主要介紹了JS實(shí)現(xiàn)點(diǎn)擊鏈接切換顯示隱藏內(nèi)容的方法,涉及javascript鼠標(biāo)事件響應(yīng)及頁(yè)面元素屬性動(dòng)態(tài)變換相關(guān)操作技巧,需要的朋友可以參考下
    2017-10-10
  • uniapp使用uni-imei插件獲取手機(jī)的設(shè)備號(hào)

    uniapp使用uni-imei插件獲取手機(jī)的設(shè)備號(hào)

    uniapp框架是一款開(kāi)發(fā)跨平臺(tái)應(yīng)用的工具,它支持iOS、Android以及Web等多個(gè)平臺(tái),在這些平臺(tái)中,uniapp可以訪問(wèn)某些設(shè)備的硬件信息,這篇文章主要給大家介紹了關(guān)于uniapp使用uni-imei插件獲取手機(jī)設(shè)備號(hào)的相關(guān)資料,需要的朋友可以參考下
    2024-01-01
  • JavaScript實(shí)現(xiàn)旋轉(zhuǎn)圖像的三種方法介紹

    JavaScript實(shí)現(xiàn)旋轉(zhuǎn)圖像的三種方法介紹

    在文檔掃描Web應(yīng)用中,我們需要旋轉(zhuǎn)傾斜的或掃描方向錯(cuò)誤的文檔圖像,這篇文章主要為大家整理了使用JavaScript旋轉(zhuǎn)圖像的三種方法,希望對(duì)大家有所幫助
    2024-01-01
  • 獲取URL地址中的文件名和參數(shù)的javascript代碼

    獲取URL地址中的文件名和參數(shù)的javascript代碼

    JS 獲取URL地址中的文件名和參數(shù),這個(gè)版本中有詳細(xì)的注釋。
    2009-09-09
  • 關(guān)于ES6字符串的擴(kuò)展詳解

    關(guān)于ES6字符串的擴(kuò)展詳解

    es6這個(gè)String對(duì)象倒是擴(kuò)展了不少方法,但是很多都是跟字符編碼相關(guān),下面這篇文章主要給大家介紹了關(guān)于ES6字符串?dāng)U展的相關(guān)資料,文中通過(guò)實(shí)例代碼介紹的非常詳細(xì),需要的朋友可以參考下
    2022-08-08
  • 深入理解JavaScript系列(35):設(shè)計(jì)模式之迭代器模式詳解

    深入理解JavaScript系列(35):設(shè)計(jì)模式之迭代器模式詳解

    這篇文章主要介紹了深入理解JavaScript系列(35):設(shè)計(jì)模式之迭代器模式詳解,迭代器模式(Iterator):提供一種方法順序一個(gè)聚合對(duì)象中各個(gè)元素,而又不暴露該對(duì)象內(nèi)部表示,需要的朋友可以參考下
    2015-03-03
  • Spring mvc 接收json對(duì)象

    Spring mvc 接收json對(duì)象

    這篇文章主要介紹了Spring mvc 接收json數(shù)據(jù)的相關(guān)資料,需要的朋友可以參考下
    2015-12-12
  • 微信小程序的開(kāi)發(fā)范式BeautyWe.js入門(mén)詳解

    微信小程序的開(kāi)發(fā)范式BeautyWe.js入門(mén)詳解

    這篇文章主要介紹了微信小程序的開(kāi)發(fā)范式BeautyWe.js詳解,它是一套專(zhuān)注于微信小程序的企業(yè)級(jí)開(kāi)發(fā)范式,它的愿景是:讓企業(yè)級(jí)的微信小程序項(xiàng)目中的代碼,更加簡(jiǎn)單、漂亮,需要的朋友可以參考下
    2019-07-07
  • javascript排序函數(shù)實(shí)現(xiàn)數(shù)字排序

    javascript排序函數(shù)實(shí)現(xiàn)數(shù)字排序

    這篇文章主要介紹了javascript排序函數(shù)實(shí)現(xiàn)數(shù)字排序的相關(guān)資料,附上示例,需要的朋友可以參考下
    2015-06-06
  • JS中onpropertychange和onchange事件區(qū)別小結(jié)

    JS中onpropertychange和onchange事件區(qū)別小結(jié)

    當(dāng)一個(gè)HTML元素的屬性用js改變的時(shí)候,都能通過(guò)onpropertychange來(lái)捕獲。例如一個(gè)文本text對(duì)象的value屬性被頁(yè)面的腳本修改的時(shí)候,onchange無(wú)法捕獲到,而onpropertychange卻能夠捕獲。
    2010-07-07

最新評(píng)論

阜阳市| 米林县| 治县。| 调兵山市| 南川市| 晋中市| 大关县| 吉水县| 寻乌县| 九江县| 商洛市| 新河县| 上高县| 靖州| 安吉县| 海南省| 皋兰县| 吉安市| 安塞县| 辰溪县| 林口县| 吐鲁番市| 富源县| 金坛市| 芷江| 湛江市| 连云港市| 阿坝| 铜鼓县| 长垣县| 庆阳市| 乌鲁木齐市| 克山县| 南开区| 奉贤区| 青冈县| 龙岩市| 福鼎市| 久治县| 堆龙德庆县| 抚宁县|