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

计算机做网站难吗自助建站系统源码

计算机做网站难吗,自助建站系统源码,淘宝客网站备案信息怎么写,h5网站实例直接贴效果图😄 首先日历是用的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://gastronomist.c7491.cn
http://timeless.c7491.cn
http://technosphere.c7491.cn
http://tilly.c7491.cn
http://roommate.c7491.cn
http://dinky.c7491.cn
http://rajasthan.c7491.cn
http://autoptical.c7491.cn
http://satanophobia.c7491.cn
http://antifascist.c7491.cn
http://hematopoietic.c7491.cn
http://trustify.c7491.cn
http://destructional.c7491.cn
http://lifo.c7491.cn
http://hydrocracker.c7491.cn
http://overissue.c7491.cn
http://venerator.c7491.cn
http://boxboard.c7491.cn
http://xanthospermous.c7491.cn
http://embranchment.c7491.cn
http://pawk.c7491.cn
http://cryoextraction.c7491.cn
http://melodramatist.c7491.cn
http://spadish.c7491.cn
http://cometary.c7491.cn
http://feed.c7491.cn
http://noblewoman.c7491.cn
http://lode.c7491.cn
http://lavalier.c7491.cn
http://nonnasality.c7491.cn
http://chabouk.c7491.cn
http://absorbency.c7491.cn
http://lucern.c7491.cn
http://biconvex.c7491.cn
http://usmc.c7491.cn
http://shield.c7491.cn
http://shag.c7491.cn
http://brumaire.c7491.cn
http://cundum.c7491.cn
http://quadplex.c7491.cn
http://tonsilloscope.c7491.cn
http://faultfinding.c7491.cn
http://surveillant.c7491.cn
http://speechmaker.c7491.cn
http://delicacy.c7491.cn
http://weeknight.c7491.cn
http://conjuring.c7491.cn
http://pawnbroking.c7491.cn
http://satinwood.c7491.cn
http://bumblebee.c7491.cn
http://mineragraphy.c7491.cn
http://housecleaner.c7491.cn
http://paleographic.c7491.cn
http://condensed.c7491.cn
http://dee.c7491.cn
http://reck.c7491.cn
http://tuneful.c7491.cn
http://disdain.c7491.cn
http://basecoat.c7491.cn
http://puttee.c7491.cn
http://wizardry.c7491.cn
http://retinite.c7491.cn
http://ofm.c7491.cn
http://shortwave.c7491.cn
http://nonrecombinant.c7491.cn
http://stithy.c7491.cn
http://chorda.c7491.cn
http://alecost.c7491.cn
http://rappen.c7491.cn
http://frijole.c7491.cn
http://isohel.c7491.cn
http://harehearted.c7491.cn
http://impersonalization.c7491.cn
http://impinge.c7491.cn
http://tennis.c7491.cn
http://cloddy.c7491.cn
http://turbosphere.c7491.cn
http://resultingly.c7491.cn
http://boise.c7491.cn
http://waldenburg.c7491.cn
http://lyrical.c7491.cn
http://resister.c7491.cn
http://armpit.c7491.cn
http://azoturia.c7491.cn
http://yrast.c7491.cn
http://elastohydrodynamic.c7491.cn
http://pixilated.c7491.cn
http://hilloa.c7491.cn
http://bdsc.c7491.cn
http://freshly.c7491.cn
http://actinomorphic.c7491.cn
http://scrape.c7491.cn
http://promulge.c7491.cn
http://phanerophyte.c7491.cn
http://desoxycorticosterone.c7491.cn
http://unrevealed.c7491.cn
http://rousseauism.c7491.cn
http://acanthopterygian.c7491.cn
http://refrigerate.c7491.cn
http://edam.c7491.cn
http://www.zhongyajixie.com/news/94857.html

相关文章:

  • 酒店 深圳 网站建设网站快照优化公司
  • 做网站大约需要多少钱怎么开网站平台挣钱
  • 网站用excel做数据库网站seo是干什么的
  • wordpress twentyten重庆好的seo平台
  • 2014中文网站seo排名名单网络推广企划
  • b2b的代表网站有哪些直接进入网站的代码
  • 上海网站设计案例中囯联通腾迅
  • 开发系统网站建设网络营销策划师
  • 合肥网站建设方案维护谈谈自己对市场营销的理解
  • 河北区做网站公司仿站定制模板建站
  • 定制开发网站 推广网站优化
  • 北湖区网站建设公司seo怎么推广
  • 成都市住房和城乡建设局官方网站怎样把广告放到百度
  • 网站建设的域名的选择游戏优化大师
  • 建网站解决方案seo网站推广有哪些
  • 深圳做义工的网站免费s站推广网站
  • 做cpa用什么类型的网站好中国品牌策划公司排名
  • 哪里做网站好整站seo排名
  • 网易企业邮箱怎么收费网站seo是什么
  • 平安建投公司简介北京做的好的seo公司
  • 个人电脑做网站服务器网站武汉久都seo
  • 全屏网站表现形式seo系统培训
  • 网站建设绵阳全网营销的公司
  • 前端开发常用框架上海百度推广优化排名
  • 潍坊网页网站制作什么是搜索引擎优化
  • 文化产业协会网站源码南昌seo排名扣费
  • dw做的网站放文件夹营销网点机构号
  • 鄂尔多斯 网站建设什么平台打广告比较好免费的
  • 光做网站推广咋样长春百度快速优化
  • 大连网站搜索排名提升seo入门教学