<template lang="pug">
    .oc-dialog-cover.tips(v-if="msg && msg.length > 0", :class="(time > 0? 'tipsNoCover ': '') + type")
        .oc-dialog
            .dialog-bd
                i.tip-icon(:class="type")
                div(v-html="msg")
            .dialog-close(v-on:click="remove") ×
</template>

<script>
    export default {
        name: 'oc-tips',
        props: {
            time: { type: Number, default: 0 },
            msg: String,
            type: String
        },

        methods: {
            remove() {
                $(this.$el).remove();
            }
        },
        
        mounted() {
            if(this.time && this.time > 0) {
                setTimeout( e => {
                    this.remove();
                }, this.time);
            }
        }
    }
</script>