setTimer.vue 1010 Bytes
<template>
  <div class="timer-sel">
    <el-select v-model="settimer" placeholder="请选择" @change="changet">
      <el-option
        v-for="(item, index) in timeroptions"
        :key="index"
        :label="item.name"
        :value="item.value"
      >
      </el-option>
    </el-select>
  </div>
</template>

<script>
export default {
  data() {
    return {
      settimer: 0,
      timeroptions: [{name:5,value:5},{name:10,value:10},{name:15,value:15},{name:30,value:30},{name:"不限时",value:-1}]
    };
  },
  methods: {
    changet(val) {
      this.$emit("timerchange", val);
    },
  },
  props: ["runtime","runindex"],
  updated(v){
    this.$nextTick(function(){
      // alert(v)
         this.settimer = this.runtime;
    });
  },
  mounted() {
    this.settimer = this.runtime;
    if (this.runindex == 0  && (this.runtime == 0 ||this.runtime == -1)) {
      this.settimer = -1;
    }
  },
  watch:{
    runtime(val) {
      this.settimer = val;
    }
  }
};
</script>

<style></style>