export default { props:{ date:{ type:Object, default(){ return { year:0, month:0, day:0, hour:0, minute:0, second:0 } } }, anotherDate:{ type:Object, default(){ return { year:0, month:0, day:0, hour:0, minute:0, second:0 } } }, options:{ type:Array, default(){ return [] } }, }, data(){ return { option:'' } }, methods:{ setOption(visible){ if(!visible)this.$refs.anotherDateYear.focus() }, calculate(){ return new Promise( (resolve, reject)=>{ setTimeout(()=>{ this.calculateAsync(); resolve(); },100) } ) }, calculateAsync(){ this.$emit('calculate',this.date,this.anotherDate,this.option,this) }, focus(name){ name=name||'dateYear'; this.$refs[name].focus(); }, log(){ console.log.apply(this,arguments) } } }