1:main.js中引入依赖

import Vue from "vue";

import { DatePicker } from 'ant-design-vue';
import 'ant-design-vue/dist/antd.css';

#设置中文
import moment from 'moment';
import 'moment/locale/zh-cn'
moment.locale('zh-cn');

  Vue.use(DatePicker)

2:使用

<template>
  <div class="about">
    <div>
      <a-date-picker placeholder="选择日期" :defaultValue="moment(getCurrentData(), 'YYYY-MM-DD')" :showToday="false"/>
    </div>
  </div>

  
</template>

<script>

import moment from "moment";


export default {
  name: 'about',
  data(){
    return {
    }
  },
  methods: {
    moment,
    getCurrentData(){
      return new Date().toLocaleDateString();
    }
  }
}
</script>

 

转载于:https://www.cnblogs.com/yshyee/p/11174778.html

Logo

前往低代码交流专区

更多推荐