1. date-of-birth

date-of-birth

date-of-birth

出生日期选择器

安装依赖前准备

1:需安装Vue;
2:需安装Element-UI;

安装依赖

 # install dependencies
npm install date-of-birth --save
# or with yarn
yarn add date-of-birth

使用步骤

 # 在main.js中引入并注册
import DateOfBirth from 'date-of-birth';
Vue.use(DateOfBirth);
# 在页面中使用
<date-of-birth ref="clear" width="100%" @change="getValue" :title="title"></date-of-birth>

data () {
  return {
    title: {
      year: 'Year',
      month: 'Month',
      day: 'Day',
    }
  }
}
methods: {
  getValue (value) {
    console.log(value); // 'YYYY-MM-DD'
  }
  // 清空选中的值
  clearValue () {
    this.$refs.clear.reset()
  }
}

参数说明

 # width (required: false, type: String)
该组件的宽度
# title (required: true, type: Object)
该组件中的title,分别对应年月日,可自定义
# @change
该组件返回的值