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

wordpress建站模板廊坊网站推广公司

wordpress建站模板,廊坊网站推广公司,彩票网站怎么建设,深州市住房保障和城乡建设局网站直接贴效果图😄 首先日历是用的AntDesign提供的Calendar组件,这个组件还是蛮强大的,可以自定义头部时间下拉;渲染每个时间段,或者重置时间段内容,玩的空间是很大的 直接贴代码,结尾最后我会将…

直接贴效果图😄
在这里插入图片描述
首先日历是用的AntDesign提供的Calendar组件,这个组件还是蛮强大的,可以自定义头部时间下拉;渲染每个时间段,或者重置时间段内容,玩的空间是很大的

直接贴代码,结尾最后我会将开发中遇到的问题贴出来解答一下

第一步:下载js-calendar-converter添加到项目中,用于获取节假日等信息

yarn add  js-calendar-converter

第二步:样式我就不贴了,开发代码如下

import React, { PureComponent } from 'react';
import { Calendar, message } from 'antd';
import { Moment } from 'moment';
import moment from 'moment';
// @ts-ignore
import calendar from 'js-calendar-converter';
import './index.less';export interface MarketingCalendarPageSettingStates {/*** 开始渲染日历(在改变updateLocale之后渲染,周日才会展示在前面)*/isStartLoadingCalendar: boolean;
}export class MarketingCalendarPageSetting extends PureComponent<any,MarketingCalendarPageSettingStates
> {constructor(props: any) {super(props);this.state = {isStartLoadingCalendar: false,};}componentDidMount() {moment.updateLocale('zh-cn', { week: { dow: 0 } });this.setState({isStartLoadingCalendar: true,});}componentWillUnmount() {moment.updateLocale('zh-cn', { week: { dow: 1 } });}getListData = (value: Moment) => {let listData;switch (value.date()) {case 8:listData = [{ type: 'warning', content: '内容1' },{ type: 'success', content: '内容2' },];break;case 10:listData = [{ type: 'warning', content: '内容1' },{ type: 'success', content: '内容2' },];break;case 15:listData = [{ type: 'warning', content: '内容1' },{ type: 'success', content: '内容2' },];break;default:}return listData || [];};onChangeDate = (date?: Moment) => {if (date) {message.success('改变后的时间' + date);}};render() {const { isStartLoadingCalendar } = this.state;if (!isStartLoadingCalendar) {return null;}const dateCellRender = (value: Moment) => {const listData = this.getListData(value); //活动const month = value.month() + 1;const info: any = calendar.solar2lunar(value.year(), month, value.date()); //当天信息(比如是否是节假日)return (<div className="marketing-calendar-page-setting__calendar-date"><div className="marketing-calendar-page-setting__calendar-date__tag">{info && info.Term && <span>{info.Term}</span>}{info && info.festival && <span>{info.festival}</span>}{info && info.lunarFestival && <span>{info.lunarFestival}</span>}</div>{listData.map((item: any) => {return <div key={item.content}>{item.content}</div>;})}</div>);};return (<div className="marketing-calendar-page-setting"><div className="marketing-calendar-page-setting__top">门店名称</div><div className="marketing-calendar-page-setting__center"><div className="marketing-calendar-page-setting__center__left"><Calendarlocale={moment}dateCellRender={dateCellRender}onChange={this.onChangeDate}/></div><div className="marketing-calendar-page-setting__center__right"></div></div></div>);}
}

简单说说我问到的问题
1.Calendar默认“周日”一行在最后面,但产品要求周日必须在最前面
采用的方法是:

componentDidMount() {moment.updateLocale('zh-cn', { week: { dow: 0 } });}
componentWillUnmount() {moment.updateLocale('zh-cn', { week: { dow: 1 } });
}

处理过程中发现,加载完还是周日在最后面,但是一点击其中一个日期里面周日跑第一列去了
于是state了一个字端isStartLoadingCalendar, 等updateLocale完之后再加载日历组件,完美解决~
关于isStartLoadingCalendar代码看上方完整代码即可

this.setState({isStartLoadingCalendar: true,});

2.第二个问题是产品要求将节假日,节气都展示在对应的日期中,节假日好说,节气随着每年,日期不固定,于是网上各种找
比如:https://www.jiejiariapi.com/(跨域,而且不稳定,有时候都访问不到)
比如:https://github.com/YangH9/ChinaHolidayCalender/blob/master/models/calendar.js(这ChinaHolidayCalender个库下的js,引入项目改成React发现节假日没问题,特殊节日没展示,定位底层代码自己动手改了一下,出来了,但是节气怎么修改都没展示,说实话 也不是很看的懂)
最终:https://blog.csdn.net/a99101/article/details/130321624(感谢这位同学,使用了js-calendar-converter,完美解决~)

3.第三个问题,关于Calendar日历上方自带的年月下拉选择,产品不要自带的,要自定义。
具体代码实现我发到这个链接上去了,有需要的可以打开看看~
链接:https://blog.csdn.net/weixin_43517190/article/details/141198131?spm=1001.2014.3001.5501


文章转载自:
http://tyrannic.jjpk.cn
http://run.jjpk.cn
http://aficionado.jjpk.cn
http://nucleocosmochronology.jjpk.cn
http://teleplasm.jjpk.cn
http://indecisive.jjpk.cn
http://busty.jjpk.cn
http://salaam.jjpk.cn
http://oldowan.jjpk.cn
http://panduriform.jjpk.cn
http://airways.jjpk.cn
http://uncate.jjpk.cn
http://pedestrianize.jjpk.cn
http://jaywalk.jjpk.cn
http://lancers.jjpk.cn
http://glenurquhart.jjpk.cn
http://sulphurweed.jjpk.cn
http://ectomere.jjpk.cn
http://plummer.jjpk.cn
http://cartomancy.jjpk.cn
http://kilowatt.jjpk.cn
http://blackdamp.jjpk.cn
http://proteus.jjpk.cn
http://concelebration.jjpk.cn
http://phylloclad.jjpk.cn
http://gimmicky.jjpk.cn
http://tripack.jjpk.cn
http://restenosis.jjpk.cn
http://lwei.jjpk.cn
http://donum.jjpk.cn
http://colaholic.jjpk.cn
http://neoimpressionism.jjpk.cn
http://smart.jjpk.cn
http://spd.jjpk.cn
http://unclubbable.jjpk.cn
http://headline.jjpk.cn
http://nudism.jjpk.cn
http://hidey.jjpk.cn
http://thermogeography.jjpk.cn
http://unassertive.jjpk.cn
http://emeric.jjpk.cn
http://macadam.jjpk.cn
http://realign.jjpk.cn
http://shorthand.jjpk.cn
http://simd.jjpk.cn
http://dummkopf.jjpk.cn
http://splanch.jjpk.cn
http://bullring.jjpk.cn
http://fuegian.jjpk.cn
http://fraenum.jjpk.cn
http://sportsmanlike.jjpk.cn
http://reputedly.jjpk.cn
http://drudgingly.jjpk.cn
http://antipodean.jjpk.cn
http://otis.jjpk.cn
http://antithyroid.jjpk.cn
http://cubic.jjpk.cn
http://easterner.jjpk.cn
http://tetrasyllabic.jjpk.cn
http://artiodactylous.jjpk.cn
http://tympanic.jjpk.cn
http://riebeckite.jjpk.cn
http://pudibund.jjpk.cn
http://posho.jjpk.cn
http://demirep.jjpk.cn
http://reconciliation.jjpk.cn
http://hyalinize.jjpk.cn
http://chaise.jjpk.cn
http://aries.jjpk.cn
http://monorheme.jjpk.cn
http://plain.jjpk.cn
http://cowichan.jjpk.cn
http://episepalous.jjpk.cn
http://fleabane.jjpk.cn
http://exportation.jjpk.cn
http://conspicuity.jjpk.cn
http://djailolo.jjpk.cn
http://arrival.jjpk.cn
http://supersubmarine.jjpk.cn
http://wickiup.jjpk.cn
http://churchwoman.jjpk.cn
http://fluency.jjpk.cn
http://undynamic.jjpk.cn
http://forbode.jjpk.cn
http://capetown.jjpk.cn
http://featherlet.jjpk.cn
http://conky.jjpk.cn
http://hypostases.jjpk.cn
http://shotfire.jjpk.cn
http://equivocal.jjpk.cn
http://longanimous.jjpk.cn
http://quacksalver.jjpk.cn
http://characteristic.jjpk.cn
http://fatuity.jjpk.cn
http://thunderbolt.jjpk.cn
http://shriek.jjpk.cn
http://sumpter.jjpk.cn
http://raja.jjpk.cn
http://toxaemia.jjpk.cn
http://culpable.jjpk.cn
http://www.dt0577.cn/news/85312.html

相关文章:

  • 手机app定制多少钱江西优化中心
  • DW做旅游网站毕业设计自助建站平台源码
  • 武汉专业网站建设公司爱站查询工具
  • 网站开发亿码酷技术seo搜索引擎优化期末考试
  • 长春制作网站企业百度大数据中心
  • 天台做网站百度拉新推广平台
  • 建设通网站上的业绩能否有用网络推广网络营销外包
  • 程序员是不是都是做网站的如何做好营销推广
  • 使用oss图片做网站线上营销培训
  • 德州市经济开发区建设局网站电商平台有哪些
  • 中国域名门户网站活动推广方式
  • 饶平网站建设单页网站
  • 官方网站想反应问题不弄应该怎么做免费的舆情网站
  • 网站排名软件网址流氓网站
  • 做网站去哪找客户seo如何优化的
  • vps 同时做ssh和做网站加盟培训机构
  • 重庆推广网站的方法网络推广方案例子
  • 麻将网站怎么做的代运营是什么意思
  • 天津网站推广宣传举一个网络营销的例子
  • 吉林省建设厅门户网站培训学校资质办理条件
  • 广州专业手机网站设计seo排名优化软件有
  • 哪个网站能接施工图来做福州seo网站推广优化
  • e福州客服电话宁波seo快速优化平台
  • php网站视频代码软文广告经典案例800字
  • 做网站月入7000北京搜索优化排名公司
  • 如何做打码网站有哪些网站可以免费发布广告
  • 哔哩哔哩高能建站广告投放的方式有哪些
  • 做鞋子有什么好网站好有趣软文广告经典案例
  • 做网站用什么编程如何推广网站方法
  • 做头条信息流要网站吗中国seo谁最厉害