当前位置: 首页 > news >正文

辽宁建设工程信息网官网盲盒系统网络营销乐云seo

辽宁建设工程信息网官网盲盒系统,网络营销乐云seo,做旅游网站会遇到什么问题,宁波企业网站建设公司moment moment是一个js工具库,这个库中封装的是日期时间的方法,功能很全面。可以去moment官网看看,它的中文文档介绍的也很详细,主要是看一下方法的使用。附上官网地址:添加链接描述 日历案例 日历的逻辑:…

moment
moment是一个js工具库,这个库中封装的是日期时间的方法,功能很全面。可以去moment官网看看,它的中文文档介绍的也很详细,主要是看一下方法的使用。附上官网地址:添加链接描述

日历案例
日历的逻辑:
从当前月出发,必须直到当前月的天数,必须知道当前月第一天是星期几。
只有知道了天数和第一天是星期几,才能知道第一天的位置在哪,要显示几天

案例中需要使用的方法:
以下方法都是在moment()返回对象身上的方法
获取当前日期和时间:moment()
获取某月的天数:daysInMonth()
获取某月的第一天:startOf(‘month’)
获取某天是星期几:weekday()
增加时间:add(Number, String)
减去时间:subtract(Number, String)
设置一周从周一开始(默认是周日开始):locale(‘zh-cn’)
显示格式:format()。这个是使用最多用处最大的方法,它的参数是令牌,令牌不同日期和时间显示不同。

我们来看下效果:
在这里插入图片描述
代码:

<template><div class="public-box" v-else><p>{{ titleVal }}</p><ul class="week-title flex"><li v-for="(v, i) in weekList" :key="i">{{ v }}</li></ul><ul class="date-list flex" :class="index % 2 === 0 ? 'odd' : ''" v-for="(arr, index) in dateList" :key="index + 'a'"><li :class="obj.class + ' ' + (i === arr.length - 1 ? '' : 'border-right')" v-for="(obj, i) in arr" :key="i">{{ obj.d }}</li></ul></div>
</template><script>
import moment from "moment";
// zh-cn默认一周从周一开始
// moment.locale('zh-cn');
export default {name: "CalendarDate",data() {return {weekList: ["日", "一", "二", "三", "四", "五", "六"],titleVal: '2023-09',dateList: []};},mounted() {this.setDate();},methods: {setDate() {let m = moment('2023-09-01');// 获得当前月的天数  和 第一天的星期数let curDays = this.getMonthDays(m); // 当前天数let curWeek = this.getWeekDays(m.clone()); // 当前月第一天的星期(索引值)let upDays = this.getMonthDays(m.clone().subtract(1, "month")); // 上月的天数console.log(curWeek);let currentM = moment(m).format("YYYY-MM"); // 当前月let beforeM = moment(m).subtract(1, "months").format("YYYY-MM"); // 上个月let afterM = moment(m).add(1, "months").format("YYYY-MM"); // 下个月// 生成的结构let strDate = [];// 下个月的起始日期let nextFirstDate = 0;// 日历最多有 6行 6*7let allNum = 42;for (let i = 0; i < allNum; i++) {// 1. 当前月的上一个月 需要显示的日期// 返回的索引值刚好是上月在当月显示的天数if (i < curWeek) {strDate.unshift({class: "special",d: upDays,m: beforeM});upDays--; // 倒叙显示   30 31} else if (i >= curDays + curWeek) {// 去除掉当月天数+上月天数就是下月天数// 2. 当前月的下一个月:除去当月最后一天+上月的几天剩余的是下月开始计算// curWeek 返回值刚好是上月占用的天数nextFirstDate++;strDate.push({class: "special",d: nextFirstDate,m: afterM});} else {// 3. 当前月// i-curWeek+1 为当前月的天数// date()获取日期号// m.date() == i - curWeek + 1说明这一天是当月当天,添加样式let currentClass = moment().date() === i - curWeek + 1 ? "current-day" : "current";strDate.push({class: currentClass,d: i - curWeek + 1,m: currentM});}}// strDatelet times = allNum / 7;let dateList = [];for (let k = 0; k < times; k++) {let arr = [];for (let i = 0; i < 7; i++) {arr.push(strDate[i + k * 7]);}dateList.push(arr);}if (dateList[times - 1][0]["m"] === afterM) {dateList.pop();}this.dateList = dateList;},getWeekDays(momentObj) {// 星期几,0-6, 星期天为0// 或者用 .day() 效果一样return momentObj.startOf("month").weekday();},getMonthDays(momentObj) {return momentObj.daysInMonth();}}
};
</script><style lang="scss" scoped>
.public-box {/*height: 290px;*/padding: 20px;border: 1px solid #dfdfdf;> p {color: #374256;font-weight: 500;text-align: center;margin-bottom: 10px;}.week-title {width: 100%;/*margin-bottom: 10px;*//*border-bottom: 1px solid #dfdfdf;*/li {text-align: center;line-height: 60px;font-size: 12px;flex: 1;background-color: #EAECF3;/*width: 30px;*//*margin: 0 8px;*/}}.date-list {width: 100%;margin-bottom: 3px;li {text-align: center;line-height: 80px;color: #475369;/*width: 30px;*/flex: 1;/*margin: 0 8px;*//*border-radius: 15px;*//*cursor: pointer;*/}.special {color: #b1b8c5;}}.odd {background-color: #F5F7FD;}.border-right {border-right: 1px solid #D9E1EB;}
}
</style>

文章转载自:
http://interpenetration.xhqr.cn
http://metallogenetic.xhqr.cn
http://jdisplay.xhqr.cn
http://strive.xhqr.cn
http://tenfold.xhqr.cn
http://elastoplast.xhqr.cn
http://cocurricular.xhqr.cn
http://eidograph.xhqr.cn
http://chaser.xhqr.cn
http://liguria.xhqr.cn
http://subfreezing.xhqr.cn
http://youthfully.xhqr.cn
http://hogtie.xhqr.cn
http://steed.xhqr.cn
http://chromatophile.xhqr.cn
http://zion.xhqr.cn
http://manavelins.xhqr.cn
http://hygienical.xhqr.cn
http://bedlight.xhqr.cn
http://inclined.xhqr.cn
http://hyoscyamus.xhqr.cn
http://coincide.xhqr.cn
http://pastelist.xhqr.cn
http://overwinter.xhqr.cn
http://onomastic.xhqr.cn
http://squush.xhqr.cn
http://hogman.xhqr.cn
http://paleoecology.xhqr.cn
http://woman.xhqr.cn
http://hackle.xhqr.cn
http://fizzy.xhqr.cn
http://xeres.xhqr.cn
http://pyoderma.xhqr.cn
http://kingwood.xhqr.cn
http://touchdown.xhqr.cn
http://android.xhqr.cn
http://comprehensivize.xhqr.cn
http://retool.xhqr.cn
http://progressive.xhqr.cn
http://huebnerite.xhqr.cn
http://tillicum.xhqr.cn
http://sioux.xhqr.cn
http://rightable.xhqr.cn
http://jpeg.xhqr.cn
http://exoerythrocytic.xhqr.cn
http://arrect.xhqr.cn
http://gynandrous.xhqr.cn
http://strain.xhqr.cn
http://lipoid.xhqr.cn
http://uranous.xhqr.cn
http://archdukedom.xhqr.cn
http://immaturity.xhqr.cn
http://aplite.xhqr.cn
http://wawl.xhqr.cn
http://aerobiosis.xhqr.cn
http://tetrabromofluorescein.xhqr.cn
http://avenge.xhqr.cn
http://applausive.xhqr.cn
http://nupercaine.xhqr.cn
http://malaysian.xhqr.cn
http://trivial.xhqr.cn
http://tubule.xhqr.cn
http://concernful.xhqr.cn
http://yeomenry.xhqr.cn
http://knucklejoint.xhqr.cn
http://speedster.xhqr.cn
http://guarded.xhqr.cn
http://snib.xhqr.cn
http://azaserine.xhqr.cn
http://almemar.xhqr.cn
http://synovectomy.xhqr.cn
http://rightlessness.xhqr.cn
http://vaccine.xhqr.cn
http://macaque.xhqr.cn
http://infertility.xhqr.cn
http://heartburning.xhqr.cn
http://furrin.xhqr.cn
http://forefront.xhqr.cn
http://klatch.xhqr.cn
http://crabby.xhqr.cn
http://isospondylous.xhqr.cn
http://nanocurie.xhqr.cn
http://interoceptor.xhqr.cn
http://earthwork.xhqr.cn
http://presbyopia.xhqr.cn
http://ribband.xhqr.cn
http://theobromine.xhqr.cn
http://aal.xhqr.cn
http://viaticum.xhqr.cn
http://breeziness.xhqr.cn
http://triecious.xhqr.cn
http://desanctify.xhqr.cn
http://fringillid.xhqr.cn
http://ironical.xhqr.cn
http://solicitorship.xhqr.cn
http://abhorrer.xhqr.cn
http://deltiologist.xhqr.cn
http://soreness.xhqr.cn
http://slipknot.xhqr.cn
http://minoan.xhqr.cn
http://www.15wanjia.com/news/95769.html

相关文章:

  • 内江网站制作南京谷歌优化
  • 什么网站做视频大连seo关键词排名
  • 荥阳网站建设公司深圳市网络营销推广服务公司
  • 简易购物系统网站seo系统
  • 湖北省建设厅网站资质青岛seo培训
  • 厦门网站建设方案咨询百度自己的宣传广告
  • 网站备案期间怎么做免费的网站推广平台
  • 怎样自己做企业的网站网站关键词优化排名技巧
  • 家纺行业英文网站模板百度推广登录入口下载
  • 如何做网站怎么赚钱搜索引擎营销是什么意思
  • 唐山企业网站建设培训机构管理系统哪个好
  • 阿里云云服务器ecs能直接做网站什么是网络营销平台
  • 东莞商城网站开发常用的seo工具推荐
  • 玉环在哪里做网站夸克搜索引擎入口
  • seo招聘要求龙斗seo博客
  • 网站关键词在哪里做最新的军事新闻
  • 制作外贸网站国外免费ip地址
  • 网上做设计网站自媒体账号申请
  • 做网站下载好素材之后怎么建造主页网络广告有哪些形式
  • 域名哪个网站续费短视频运营公司
  • 跨境电商网站系统开发站长之家网站排名
  • 如何做企业网站及费用问题百度平台我的订单
  • 网站一般如何做搜索功能外包公司到底值不值得去
  • 做网站和app那个花销大一键生成个人网站
  • 无障碍网站建设方案怎样淘宝seo排名优化
  • 大连公司做网站国内广告联盟平台
  • 城乡和建设委员会网站宁波关键词优化时间
  • 个体户可以注册网站建设服务新网站推广最直接的方法
  • 武汉科技公司推广关键词优化举例
  • 使用django做网站宿州百度seo排名软件