riku
2024-05-08 d0f5933cb7fe9196ca0250252efc820a1a9d947e
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<template>
  <BaseCard size="middle-s" direction="up">
    <template #content>
      <el-row align="middle" style="gap: 6px">
        <div>历史轨迹</div>
        <div class="map-btn-group">
          <font-awesome-icon
            :icon="btnStop.icon"
            :class="'btn-search m-r-2 ' + btnStop.clz"
            @click="handleStop"
          />
          <font-awesome-icon
            :icon="btnPlay.icon"
            class="btn-search"
            @click="handlePlayOrPause"
          />
        </div>
        <div class="label-date margin-left-2">
          <span class="label-date-title">倍速</span>
          <el-select v-model="speed" size="small" class="w-80">
            <el-option label="1.0X" :value="1" />
            <el-option label="4.0X" :value="4" />
            <el-option label="8.0X" :value="8" />
            <el-option label="16X" :value="16" />
          </el-select>
        </div>
      </el-row>
    </template>
  </BaseCard>
</template>
<script>
export default {
  props: {},
  emits: ['change'],
  data() {
    return {
      speed: 1,
      // 动画状态,0:停止;1:播放;2:暂停
      status: 0
    };
  },
  computed: {
    btnStop() {
      return {
        icon: 'fa fa-stop',
        clz: this.status == 0 ? 'btn-disable' : 'btn-able'
      };
    },
    btnPlay() {
      return {
        icon: this.status == 1 ? 'fa fa-pause' : 'fa fa-play'
      };
    }
  },
  methods: {
    handleStop() {
      if (this.status != 0) {
        this.status = 0;
        this.handleChange();
      }
    },
    handlePlayOrPause() {
      if (this.status == 1) {
        this.status = 2;
      } else {
        this.status = 1;
      }
      this.handleChange();
    },
    handleChange() {
      console.log(this.status);
      this.$emit('change', this.status);
    }
  },
  mounted() {}
};
</script>
<style scoped>
.btn-able {
  color: red;
}
 
.btn-disable {
  color: gray;
}
</style>