<template>
    <div>
        {{text}}
    </div>
</template>
<script>
export default {
    name:'format',
    components: {

    },
    props: {
        type: {
            type: String,
            default() {
                return ''
            }
        },
        value: {
            type: String,
            default() {
                return '';
            }
        },
        param: {
            type: String,
            default() {
                return ''
            }
        }
    },
    data() {
        return {

        }
    },
    computed: {
        text() {
            return this.format();
        }
    },
    created: function () {

    },
    beforeMount: function () {

    },
    mounted: function () {

    },
    beforeDestroy: function () {

    },
    destroyed: function () {

    },
    methods: {
        format() {
            switch (this.type) {
                case 'date':
                    return this.value ? new Date(this.value).Format(this.param) : ""
                default:
                    return ''
            }
        }
    },
    watch: {

    },
    directives: {

    }
}
</script>
