123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- 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)
- }
- }
- }
|