<template>
  <span :class="{'red':isExpire}">{{ value }}</span>
</template>

<script lang="ts">
import { Component, Prop, Vue, Watch } from "vue-property-decorator";
@Component
export default class TimeComp extends Vue {
  value:any=null;
  isExpire:boolean=false
  @Prop()
  propConfig: any

  @Prop()
  propValue?:any

  @Prop()
  parentValue:any

  @Watch('propValue')
  propValueChange(v:any){
    this.setValue(v);
  }

  mounted(){
    if(this.propValue){
      this.setValue(this.propValue)
    }
  }

  setValue(v:any){
    this.value = v;
    if(this.value){
      if(new Date() > new Date(this.value)){
        this.isExpire = true
      }else{
        this.isExpire = false
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.red{
  color: red;
}
</style>