setTimer.vue
1010 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<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>