mirror of
https://github.com/cool-team-official/cool-admin-vue.git
synced 2024-11-01 22:20:27 +08:00
48 lines
613 B
Vue
48 lines
613 B
Vue
<template>
|
|
<div class="icon-voice">
|
|
<icon-svg :name="`voice${index}`"></icon-svg>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
props: {
|
|
play: Boolean
|
|
},
|
|
|
|
data() {
|
|
return {
|
|
timer: null,
|
|
index: ""
|
|
};
|
|
},
|
|
|
|
watch: {
|
|
play(val) {
|
|
clearInterval(this.timer);
|
|
|
|
if (val) {
|
|
this.index = 1;
|
|
|
|
this.timer = setInterval(() => {
|
|
if (this.index == 1) {
|
|
this.index = "";
|
|
} else {
|
|
this.index += 1;
|
|
}
|
|
}, 500);
|
|
} else {
|
|
this.index = "";
|
|
}
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.icon-voice {
|
|
display: inline-block;
|
|
margin-right: 5px;
|
|
}
|
|
</style>
|