<template>
     <el-date-picker type="date" :format="(data.format||'YYYY/MM/DD')" @change="dateChange"></el-date-picker>
</template>

<script>
import {
    reactive,
    getCurrentInstance 
} from "vue"
import {
    getDefautlDate
} from "../../utils"
export default {
    props: {
        data: {
            type: Object
        },
        validator: {
            type: Function
        }
    },
    setup(props) {
         const {
            parent
        } = getCurrentInstance();
         const {
            id,
            change
        } = reactive(props).data;
        const dateChange = (value) => {
            parent.parent.parent.proxy.formModel[id] = getDefautlDate(value);
            if(change){
                change();
            }
        }
        return {
          dateChange
        }
    }
}
</script>

<style lang="less" scoped>

</style>
