70.e9b7cd91.js 1.7 KB

1
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([[70],{"986ad":function(t,e,a){"use strict";a.r(e);var n=function(){var t=this,e=t._self._c;return e("div",{staticClass:"row q-gutter-xs"},[e("q-select",{staticStyle:{"min-width":"90px"},attrs:{options:t.yearOptions,label:"年",dense:""},on:{"update:model-value":t.updateDate},model:{value:t.year,callback:function(e){t.year=e},expression:"year"}}),e("q-select",{staticStyle:{"min-width":"80px"},attrs:{options:t.monthOptions,label:"月",dense:""},on:{"update:model-value":t.updateDate},model:{value:t.month,callback:function(e){t.month=e},expression:"month"}}),e("q-select",{staticStyle:{"min-width":"80px"},attrs:{options:t.dayOptions,label:"日",dense:""},on:{"update:model-value":t.updateDate},model:{value:t.day,callback:function(e){t.day=e},expression:"day"}})],1)},s=[],o=(a("ddb0"),{props:["modelValue"],emits:["update:modelValue"],data(){return{year:null,month:null,day:null}},computed:{yearOptions(){const t=(new Date).getFullYear();return Array.from({length:5},((e,a)=>t-a))},monthOptions(){return Array.from({length:12},((t,e)=>e+1))},dayOptions(){if(!this.year||!this.month)return[];const t=new Date(this.year,this.month,0).getDate();return Array.from({length:t},((t,e)=>e+1))}},methods:{updateDate(){if(this.year&&this.month&&this.day){const t=`${this.year}-${this.pad(this.month)}-${this.pad(this.day)}`;this.$emit("update:modelValue",t)}},pad(t){return t.toString().padStart(2,"0")}},watch:{modelValue:{immediate:!0,handler(t){if(/^\d{4}-\d{2}-\d{2}$/.test(t)){const[e,a,n]=t.split("-");this.year=parseInt(e),this.month=parseInt(a),this.day=parseInt(n)}}}}}),l=o,i=a("42e1"),d=a("ddd8"),r=a("eebe"),u=a.n(r),p=Object(i["a"])(l,n,s,!1,null,null,null);e["default"]=p.exports;u()(p,"components",{QSelect:d["a"]})}}]);