您的位置 首页 vue教程

基于ant design日期控件使用_仅月份的操作

总体效果:

展开后:

选值后:

代码部分:

1、引入:

import { DatePicker } from ‘antd’;

2、主体部分:

export default class PersonInfo extends Component{  constructor() {  super(); //设置状态,存储日期   this.state = {      workMode: ['month', 'month'],       workValue: [],     };  }  render(){    //主体引用 const {RangePicker} = DatePicker; return(      <RangePicker        placeholder={['开始日期', '结束日期']}        format="YYYY-MM"        value={this.state.workValue}        mode={this.state.workMode}        onPanelChange={this.workHandlePanelChange}       onChange={this.workOnChange}      />

函数:

//日期面板时间值改变事件workHandlePanelChange = (value, mode) => {    this.setState({      workValue:value,      workMode: [        mode[0] === 'date' ? 'month' : mode[0],        mode[1] === 'date' ? 'month' : mode[1],      ],    });  }  //日期清空时触发  workOnChange = () => {    this.setState({      workMode: ['month', 'month'],      workValue: [],    })  }

获取日期值:

//其中this.state.workValue的两个值都是毫秒,formatDate为自写的转换函数let workYearBegin = this.formatDate(this.state.workValue[0]);let workYearEnd = this.formatDate(this.state.workValue[1]);formatDate = (time) => {    if(!time){      return '';    }    let date = new Date(time);//毫秒转换成日期    let year = date.getFullYear();    let month = (date.getMonth() + 1).toString().padStart(2,'0');//月份不足两位数在前面补0    return year + '-' + month;//格式控制  }

补充知识:eact使用ant时设置DatePicker日期控件中文显示

方式一:局部设置

import 'moment/locale/zh-cn';import locale from 'antd/lib/date-picker/locale/zh_CN';//调用时引用locale<DatePicker  format="YYYY-MM-DD"  placeholder=""  locale={locale}/>

方式二:全局设置

import moment from 'moment'; import 'moment/locale/zh-cn'; moment.locale('zh-cn');

其实官方文档上面都有,还是要多看文档

Ant Design:https://ant.design/index-cn

以上这篇基于ant design日期控件使用_仅月份的操作就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持火云技术。

您可能感兴趣的文章:

  • 解决antd Form 表单校验方法无响应的问题
  • antd-DatePicker组件获取时间值,及相关设置方式
  • ant design vue中日期选择框混合时间选择器的用法说明
  • 解决antd日期选择组件,添加value就无法点击下一年和下一月问题

文章来源:火云技术网

文章标题:基于ant design日期控件使用_仅月份的操作

文章地址:https://www.pyhw.net/54014_%e5%9f%ba%e4%ba%8eant-design%e6%97%a5%e6%9c%9f%e6%8e%a7%e4%bb%b6%e4%bd%bf%e7%94%a8_%e4%bb%85%e6%9c%88%e4%bb%bd%e7%9a%84%e6%93%8d%e4%bd%9c.html

关于作者: 火云技术网

热门文章

发表评论

您的电子邮箱地址不会被公开。

307条评论

  1. Hey, this is Eric and I ran across pyhw.net a few minutes ago.

    Looks great… but now what?

    By that I mean, when someone like me finds your website – either through Search or just bouncing around – what happens next? Do you get a lot of leads from your site, or at least enough to make you happy?

    Honestly, most business websites fall a bit short when it comes to generating paying customers. Studies show that 70% of a site’s visitors disappear and are gone forever after just a moment.

    Here’s an idea…

    How about making it really EASY for every visitor who shows up to get a personal phone call you as soon as they hit your site…

    You can –

    Talk With Web Visitor is a software widget that’s works on your site, ready to capture any visitor’s Name, Email address and Phone Number. It signals you the moment they let you know they’re interested – so that you can talk to that lead while they’re literally looking over your site.

    CLICK HERE to try out a Live Demo with Talk With Web Visitor now to see exactly how it works.

    You’ll be amazed – the difference between contacting someone within 5 minutes versus a half-hour or more later could increase your results 100-fold.

    It gets even better… once you’ve captured their phone number, with our new SMS Text With Lead feature, you can automatically start a text (SMS) conversation.

    That way, even if you don’t close a deal right away, you can follow up with text messages for new offers, content links, even just “how you doing?” notes to build a relationship.

    Pretty sweet – AND effective.

    CLICK HERE to discover what Talk With Web Visitor can do for your business.

    You could be converting up to 100X more leads today!

    Eric
    PS: Talk With Web Visitor offers a FREE 14 days trial – and it even includes International Long Distance Calling.
    You have customers waiting to talk with you right now… don’t keep them waiting.
    CLICK HERE to try Talk With Web Visitor now.

    If you’d like to unsubscribe click here

  2. Hello, my name’s Eric and I just ran across your website at pyhw.net…

    I found it after a quick search, so your SEO’s working out…

    Content looks pretty good…

    One thing’s missing though…

    A QUICK, EASY way to connect with you NOW.

    Because studies show that a web lead like me will only hang out a few seconds – 7 out of 10 disappear almost instantly, Surf Surf Surf… then gone forever.

    I have the solution:

    Talk With Web Visitor is a software widget that’s works on your site, ready to capture any visitor’s Name, Email address and Phone Number. You’ll know immediately they’re interested and you can call them directly to TALK with them – literally while they’re still on the web looking at your site.

    CLICK HERE to try out a Live Demo with Talk With Web Visitor now to see exactly how it works and even give it a try… it could be huge for your business.

    Plus, now that you’ve got that phone number, with our new SMS Text With Lead feature, you can automatically start a text (SMS) conversation pronto… which is so powerful, because connecting with someone within the first 5 minutes is 100 times more effective than waiting 30 minutes or more later.

    The new text messaging feature lets you follow up regularly with new offers, content links, even just follow up notes to build a relationship.

    Everything I’ve just described is extremely simple to implement, cost-effective, and profitable.

    CLICK HERE to discover what Talk With Web Visitor can do for your business, potentially converting up to 100X more eyeballs into leads today!

    Eric
    PS: Talk With Web Visitor offers a FREE 14 days trial – and it even includes International Long Distance Calling.
    You have customers waiting to talk with you right now… don’t keep them waiting.
    CLICK HERE to try Talk With Web Visitor now.

    If you’d like to unsubscribe click here

  3. Hey there, I just found your site, quick question…

    My name’s Eric, I found pyhw.net after doing a quick search – you showed up near the top of the rankings, so whatever you’re doing for SEO, looks like it’s working well.

    So here’s my question – what happens AFTER someone lands on your site? Anything?

    Research tells us at least 70% of the people who find your site, after a quick once-over, they disappear… forever.

    That means that all the work and effort you put into getting them to show up, goes down the tubes.

    Why would you want all that good work – and the great site you’ve built – go to waste?

    Because the odds are they’ll just skip over calling or even grabbing their phone, leaving you high and dry.

    But here’s a thought… what if you could make it super-simple for someone to raise their hand, say, “okay, let’s talk” without requiring them to even pull their cell phone from their pocket?

    You can – thanks to revolutionary new software that can literally make that first call happen NOW.

    Talk With Web Visitor is a software widget that sits on your site, ready and waiting to capture any visitor’s Name, Email address and Phone Number. It lets you know IMMEDIATELY – so that you can talk to that lead while they’re still there at your site.

    You know, strike when the iron’s hot!

    CLICK HERE to try out a Live Demo with Talk With Web Visitor now to see exactly how it works.

    When targeting leads, you HAVE to act fast – the difference between contacting someone within 5 minutes versus 30 minutes later is huge – like 100 times better!

    That’s why you should check out our new SMS Text With Lead feature as well… once you’ve captured the phone number of the website visitor, you can automatically kick off a text message (SMS) conversation with them.

    Imagine how powerful this could be – even if they don’t take you up on your offer immediately, you can stay in touch with them using text messages to make new offers, provide links to great content, and build your credibility.

    Just this alone could be a game changer to make your website even more effective.

    Strike when the iron’s hot!

    CLICK HERE to learn more about everything Talk With Web Visitor can do for your business – you’ll be amazed.

    Thanks and keep up the great work!

    Eric
    PS: Talk With Web Visitor offers a FREE 14 days trial – you could be converting up to 100x more leads immediately!
    It even includes International Long Distance Calling.
    Stop wasting money chasing eyeballs that don’t turn into paying customers.
    CLICK HERE to try Talk With Web Visitor now.

    If you’d like to unsubscribe click here

  4. Hi, Eric here with a quick thought about your website pyhw.net…

    I’m on the internet a lot and I look at a lot of business websites.

    Like yours, many of them have great content.

    But all too often, they come up short when it comes to engaging and connecting with anyone who visits.

    I get it – it’s hard. Studies show 7 out of 10 people who land on a site, abandon it in moments without leaving even a trace. You got the eyeball, but nothing else.

    Here’s a solution for you…

    Talk With Web Visitor is a software widget that’s works on your site, ready to capture any visitor’s Name, Email address and Phone Number. You’ll know immediately they’re interested and you can call them directly to talk with them literally while they’re still on the web looking at your site.

    CLICK HERE to try out a Live Demo with Talk With Web Visitor now to see exactly how it works.

    It could be huge for your business – and because you’ve got that phone number, with our new SMS Text With Lead feature, you can automatically start a text (SMS) conversation – immediately… and contacting someone in that 5 minute window is 100 times more powerful than reaching out 30 minutes or more later.

    Plus, with text messaging you can follow up later with new offers, content links, even just follow up notes to keep the conversation going.

    Everything I’ve just described is extremely simple to implement, cost-effective, and profitable.

    CLICK HERE to discover what Talk With Web Visitor can do for your business.

    You could be converting up to 100X more eyeballs into leads today!

    Eric
    PS: Talk With Web Visitor offers a FREE 14 days trial – and it even includes International Long Distance Calling.
    You have customers waiting to talk with you right now… don’t keep them waiting.
    CLICK HERE to try Talk With Web Visitor now.

    If you’d like to unsubscribe click here

  5. Hi, my name is Eric and I’m betting you’d like your website pyhw.net to generate more leads.

    Here’s how:
    Talk With Web Visitor is a software widget that’s works on your site, ready to capture any visitor’s Name, Email address and Phone Number. It signals you as soon as they say they’re interested – so that you can talk to that lead while they’re still there at pyhw.net.

    Talk With Web Visitor – CLICK HERE for a live demo now.

    And now that you’ve got their phone number, our new SMS Text With Lead feature enables you to start a text (SMS) conversation – answer questions, provide more info, and close a deal that way.

    If they don’t take you up on your offer then, just follow up with text messages for new offers, content links, even just “how you doing?” notes to build a relationship.

    CLICK HERE to discover what Talk With Web Visitor can do for your business.

    The difference between contacting someone within 5 minutes versus a half-hour means you could be converting up to 100X more leads today!

    Try Talk With Web Visitor and get more leads now.

    Eric
    PS: The studies show 7 out of 10 visitors don’t hang around – you can’t afford to lose them!
    Talk With Web Visitor offers a FREE 14 days trial – and it even includes International Long Distance Calling.
    You have customers waiting to talk with you right now… don’t keep them waiting.
    CLICK HERE to try Talk With Web Visitor now.

    If you’d like to unsubscribe click here

  6. My name’s Eric and I just found your site pyhw.net.

    It’s got a lot going for it, but here’s an idea to make it even MORE effective.

    Talk With Web Visitor – CLICK HERE for a live demo now.

    Talk With Web Visitor is a software widget that’s works on your site, ready to capture any visitor’s Name, Email address and Phone Number. It signals you the moment they let you know they’re interested – so that you can talk to that lead while they’re literally looking over your site.

    And once you’ve captured their phone number, with our new SMS Text With Lead feature, you can automatically start a text (SMS) conversation… and if they don’t take you up on your offer then, you can follow up with text messages for new offers, content links, even just “how you doing?” notes to build a relationship.

    CLICK HERE to discover what Talk With Web Visitor can do for your business.

    The difference between contacting someone within 5 minutes versus a half-hour means you could be converting up to 100X more leads today!

    Eric
    PS: Studies show that 70% of a site’s visitors disappear and are gone forever after just a moment. Don’t keep losing them.
    Talk With Web Visitor offers a FREE 14 days trial – and it even includes International Long Distance Calling.
    You have customers waiting to talk with you right now… don’t keep them waiting.
    CLICK HERE to try Talk With Web Visitor now.

    If you’d like to unsubscribe click here

  7. My name’s Eric and I just came across your website – pyhw.net – in the search results.

    Here’s what that means to me…

    Your SEO’s working.

    You’re getting eyeballs – mine at least.

    Your content’s pretty good, wouldn’t change a thing.

    BUT…

    Eyeballs don’t pay the bills.

    CUSTOMERS do.

    And studies show that 7 out of 10 visitors to a site like pyhw.net will drop by, take a gander, and then head for the hills without doing anything else.

    It’s like they never were even there.

    You can fix this.

    You can make it super-simple for them to raise their hand, say, “okay, let’s talk” without requiring them to even pull their cell phone from their pocket… thanks to Talk With Web Visitor.

    Talk With Web Visitor is a software widget that sits on your site, ready and waiting to capture any visitor’s Name, Email address and Phone Number. It lets you know immediately – so you can talk to that lead immediately… without delay… BEFORE they head for those hills.

    CLICK HERE to try out a Live Demo with Talk With Web Visitor now to see exactly how it works.

    Now it’s also true that when reaching out to hot leads, you MUST act fast – the difference between contacting someone within 5 minutes versus 30 minutes later is huge – like 100 times better!

    That’s what makes our new SMS Text With Lead feature so powerful… you’ve got their phone number, so now you can start a text message (SMS) conversation with them… so even if they don’t take you up on your offer right away, you continue to text them new offers, new content, and new reasons to do business with you.

    This could change everything for you and your business.

    CLICK HERE to learn more about everything Talk With Web Visitor can do and start turing eyeballs into money.

    Eric
    PS: Talk With Web Visitor offers a FREE 14 days trial – you could be converting up to 100x more leads immediately!
    It even includes International Long Distance Calling.
    Paying customers are out there waiting.
    Starting connecting today by CLICKING HERE to try Talk With Web Visitor now.

    If you’d like to unsubscribe click here

  8. Hey there, I just found your site, quick question…

    My name’s Eric, I found pyhw.net after doing a quick search – you showed up near the top of the rankings, so whatever you’re doing for SEO, looks like it’s working well.

    So here’s my question – what happens AFTER someone lands on your site? Anything?

    Research tells us at least 70% of the people who find your site, after a quick once-over, they disappear… forever.

    That means that all the work and effort you put into getting them to show up, goes down the tubes.

    Why would you want all that good work – and the great site you’ve built – go to waste?

    Because the odds are they’ll just skip over calling or even grabbing their phone, leaving you high and dry.

    But here’s a thought… what if you could make it super-simple for someone to raise their hand, say, “okay, let’s talk” without requiring them to even pull their cell phone from their pocket?

    You can – thanks to revolutionary new software that can literally make that first call happen NOW.

    Talk With Web Visitor is a software widget that sits on your site, ready and waiting to capture any visitor’s Name, Email address and Phone Number. It lets you know IMMEDIATELY – so that you can talk to that lead while they’re still there at your site.

    You know, strike when the iron’s hot!

    CLICK HERE to try out a Live Demo with Talk With Web Visitor now to see exactly how it works.

    When targeting leads, you HAVE to act fast – the difference between contacting someone within 5 minutes versus 30 minutes later is huge – like 100 times better!

    That’s why you should check out our new SMS Text With Lead feature as well… once you’ve captured the phone number of the website visitor, you can automatically kick off a text message (SMS) conversation with them.

    Imagine how powerful this could be – even if they don’t take you up on your offer immediately, you can stay in touch with them using text messages to make new offers, provide links to great content, and build your credibility.

    Just this alone could be a game changer to make your website even more effective.

    Strike when the iron’s hot!

    CLICK HERE to learn more about everything Talk With Web Visitor can do for your business – you’ll be amazed.

    Thanks and keep up the great work!

    Eric
    PS: Talk With Web Visitor offers a FREE 14 days trial – you could be converting up to 100x more leads immediately!
    It even includes International Long Distance Calling.
    Stop wasting money chasing eyeballs that don’t turn into paying customers.
    CLICK HERE to try Talk With Web Visitor now.

    If you’d like to unsubscribe click here

  9. Good day,

    My name is Eric and unlike a lot of emails you might get, I wanted to instead provide you with a word of encouragement – Congratulations

    What for?

    Part of my job is to check out websites and the work you’ve done with pyhw.net definitely stands out.

    It’s clear you took building a website seriously and made a real investment of time and resources into making it top quality.

    There is, however, a catch… more accurately, a question…

    So when someone like me happens to find your site – maybe at the top of the search results (nice job BTW) or just through a random link, how do you know?

    More importantly, how do you make a connection with that person?

    Studies show that 7 out of 10 visitors don’t stick around – they’re there one second and then gone with the wind.

    Here’s a way to create INSTANT engagement that you may not have known about…

    Talk With Web Visitor is a software widget that’s works on your site, ready to capture any visitor’s Name, Email address and Phone Number. It lets you know INSTANTLY that they’re interested – so that you can talk to that lead while they’re literally checking out pyhw.net.

    CLICK HERE to try out a Live Demo with Talk With Web Visitor now to see exactly how it works.

    It could be a game-changer for your business – and it gets even better… once you’ve captured their phone number, with our new SMS Text With Lead feature, you can automatically start a text (SMS) conversation – immediately (and there’s literally a 100X difference between contacting someone within 5 minutes versus 30 minutes.)

    Plus then, even if you don’t close a deal right away, you can connect later on with text messages for new offers, content links, even just follow up notes to build a relationship.

    Everything I’ve just described is simple, easy, and effective.

    CLICK HERE to discover what Talk With Web Visitor can do for your business.

    You could be converting up to 100X more leads today!

    Eric
    PS: Talk With Web Visitor offers a FREE 14 days trial – and it even includes International Long Distance Calling.
    You have customers waiting to talk with you right now… don’t keep them waiting.
    CLICK HERE to try Talk With Web Visitor now.

    If you’d like to unsubscribe click here

  10. My name’s Eric and I just found your site pyhw.net.

    It’s got a lot going for it, but here’s an idea to make it even MORE effective.

    Talk With Web Visitor – CLICK HERE for a live demo now.

    Talk With Web Visitor is a software widget that’s works on your site, ready to capture any visitor’s Name, Email address and Phone Number. It signals you the moment they let you know they’re interested – so that you can talk to that lead while they’re literally looking over your site.

    And once you’ve captured their phone number, with our new SMS Text With Lead feature, you can automatically start a text (SMS) conversation… and if they don’t take you up on your offer then, you can follow up with text messages for new offers, content links, even just “how you doing?” notes to build a relationship.

    CLICK HERE to discover what Talk With Web Visitor can do for your business.

    The difference between contacting someone within 5 minutes versus a half-hour means you could be converting up to 100X more leads today!

    Eric
    PS: Studies show that 70% of a site’s visitors disappear and are gone forever after just a moment. Don’t keep losing them.
    Talk With Web Visitor offers a FREE 14 days trial – and it even includes International Long Distance Calling.
    You have customers waiting to talk with you right now… don’t keep them waiting.
    CLICK HERE to try Talk With Web Visitor now.

    If you’d like to unsubscribe click here

  11. Hi, my name is Eric and I’m betting you’d like your website pyhw.net to generate more leads.

    Here’s how:
    Talk With Web Visitor is a software widget that’s works on your site, ready to capture any visitor’s Name, Email address and Phone Number. It signals you as soon as they say they’re interested – so that you can talk to that lead while they’re still there at pyhw.net.

    Talk With Web Visitor – CLICK HERE for a live demo now.

    And now that you’ve got their phone number, our new SMS Text With Lead feature enables you to start a text (SMS) conversation – answer questions, provide more info, and close a deal that way.

    If they don’t take you up on your offer then, just follow up with text messages for new offers, content links, even just “how you doing?” notes to build a relationship.

    CLICK HERE to discover what Talk With Web Visitor can do for your business.

    The difference between contacting someone within 5 minutes versus a half-hour means you could be converting up to 100X more leads today!

    Try Talk With Web Visitor and get more leads now.

    Eric
    PS: The studies show 7 out of 10 visitors don’t hang around – you can’t afford to lose them!
    Talk With Web Visitor offers a FREE 14 days trial – and it even includes International Long Distance Calling.
    You have customers waiting to talk with you right now… don’t keep them waiting.
    CLICK HERE to try Talk With Web Visitor now.

    If you’d like to unsubscribe click here

  12. Hello, my name’s Eric and I just ran across your website at pyhw.net…

    I found it after a quick search, so your SEO’s working out…

    Content looks pretty good…

    One thing’s missing though…

    A QUICK, EASY way to connect with you NOW.

    Because studies show that a web lead like me will only hang out a few seconds – 7 out of 10 disappear almost instantly, Surf Surf Surf… then gone forever.

    I have the solution:

    Talk With Web Visitor is a software widget that’s works on your site, ready to capture any visitor’s Name, Email address and Phone Number. You’ll know immediately they’re interested and you can call them directly to TALK with them – literally while they’re still on the web looking at your site.

    CLICK HERE to try out a Live Demo with Talk With Web Visitor now to see exactly how it works and even give it a try… it could be huge for your business.

    Plus, now that you’ve got that phone number, with our new SMS Text With Lead feature, you can automatically start a text (SMS) conversation pronto… which is so powerful, because connecting with someone within the first 5 minutes is 100 times more effective than waiting 30 minutes or more later.

    The new text messaging feature lets you follow up regularly with new offers, content links, even just follow up notes to build a relationship.

    Everything I’ve just described is extremely simple to implement, cost-effective, and profitable.

    CLICK HERE to discover what Talk With Web Visitor can do for your business, potentially converting up to 100X more eyeballs into leads today!

    Eric
    PS: Talk With Web Visitor offers a FREE 14 days trial – and it even includes International Long Distance Calling.
    You have customers waiting to talk with you right now… don’t keep them waiting.
    CLICK HERE to try Talk With Web Visitor now.

    If you’d like to unsubscribe click here

网站地图