title: Vue.js computed property setInterval
body: <p>I'm new to Vue js and I have code like that:</p>
  
  <p>Para.vue</p>
  
  <pre><code>&lt;template&gt;
    &lt;t-row&gt;
      &lt;t-col :span="13"&gt;
        &lt;t-input
          :id="id+'_tam'"
          ref="tam"
          v-model="ayristirilmisPara.tam"
          reverse
          :label="label"
          :disabled="disabled"
          name="Oran *"
          :labelSpan="15"
          :inputSpan="8"
          :maxlength="tamMaxLength"
          :vNumber="true"
          @input="updateTam"
          v-validate="{ required: this.isRequired }"
          :error="errors.first('Oran *')"
          class="para"
        /&gt;
      &lt;/t-col&gt;
      &lt;t-col :span="1" style="padding-left: 0px; padding-right: 0px; padding-top: 12.5px;"&gt;,&lt;/t-col&gt;
      &lt;t-col :span="10"&gt;
        &lt;t-input
          ref="kesir"
          :id="id+'_kesir'"
          v-model="ayristirilmisPara.kesir"
          :maxlength="kesirMaxLength"
          :vNumber="true"
          :disabled="disabled"
          :name="'Oran Kesir *'"
          :labelSpan="0"
          :inputSpan="18"
          label
          @input="updateKesir"
          v-validate="{ required: this.isRequired }"
          :error="errors.first('Oran Kesir *')"
          class="para"
        /&gt;
      &lt;/t-col&gt;
      &lt;t-col :span="1"&gt;&lt;/t-col&gt;
    &lt;/t-row&gt;
  &lt;/template&gt;
  
  &lt;script&gt;
  export default {
    props: {
      tamMaxLength: {
        type: Number,
        default: 3
      },
      kesirMaxLength: {
        type: Number,
        default: 2
      },
      value: {
        type: [String, Number],
        default: "0.00"
      },
      label: {
        type: String,
        default: "",
        required: false
      },
      isRequired: {
        type: Boolean,
        default: false,
        required: false
      },
      disabled: {
        type: Boolean,
        required: false,
        default: false
      }
    },
    data() {
      return {
        tam: "0",
        kesir: "0"
      };
    },
    methods: {
      updateTam(tam) {
        if (!tam) tam = "";
        this.tam = tam;
        this.$emit("input", `${tam}.${this.kesir}`);
      },
      updateKesir(kesir) {
        if (!kesir) kesir = "";
        this.kesir = kesir;
        this.$emit("input", `${this.tam}.${kesir}`);
      }
    },
    computed: {
      ayristirilmisPara() {
          if (this.value === undefined || this.value === null) this.value = "0.0";
          const paraParcali = this.value.toString().split(".");
          let tutar = {
            tam:
              paraParcali[0] == null
                ? 0
                : paraParcali[0] || paraParcali[0] == ""
                ? 0
                : paraParcali[0],
            kesir:
              paraParcali[1] == null
                ? 0
                : paraParcali[1] || paraParcali[1] == ""
                ? 0
                : paraParcali[1]
          };
          this.tam = tutar.tam;
          this.kesir = tutar.kesir;
          this.$emit("input", `${tutar.tam}.${tutar.kesir}`);
  
          return tutar;
      }
    }
  };
  &lt;/script&gt;
  &lt;style&gt;
  .el-input {
    min-width: 45px;
  }
  .para .el-input__inner {
    padding: 0px;
  }
  &lt;/style&gt;
  
  </code></pre>
  
  <p>It works fine. It puts automatically 0 when user tries to delete all the input area with id'+_tam' and id+'_kesir'. What I want to do is, I want to wait 3 seconds for user to enter an input, if s/he doesnt enter one, then I will put the 0. I have tried to code below in computed property: </p>
  
  <pre><code> computed: {
      ayristirilmisPara() {
        setInterval(function() {
          if (this.value === undefined || this.value === null) this.value = "0.0";
          const paraParcali = this.value.toString().split(".");
          let tutar = {
            tam:
              paraParcali[0] == null
                ? 0
                : paraParcali[0] || paraParcali[0] == ""
                ? 0
                : paraParcali[0],
            kesir:
              paraParcali[1] == null
                ? 0
                : paraParcali[1] || paraParcali[1] == ""
                ? 0
                : paraParcali[1]
          };
          this.tam = tutar.tam;
          this.kesir = tutar.kesir;
          this.$emit("input", `${tutar.tam}.${tutar.kesir}`);
  
          return tutar;
        }, 3000);
      }
    }
  </code></pre>
  
  <p>But it didn't work. How can I do that? Thank you for your interest.</p>