Timers and other features for Heroes of the Storm
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 
 
 

61 Zeilen
1.1 KiB

  1. <template>
  2. <div
  3. class="objective"
  4. @click="clearObjective"
  5. v-longclick="forceClearObjective">
  6. <div>
  7. {{ objective.name }}
  8. <span v-if="objective.position"> ({{ objective.position }})</span>
  9. </div>
  10. <div>
  11. <Timer
  12. ref="timer"
  13. class="objective-timer"
  14. :initialTime="objective.initialSpawnTime"
  15. />
  16. </div>
  17. </div>
  18. </template>
  19. <style lang="sass" scoped>
  20. .objective
  21. width: 100%
  22. text-align: center
  23. &-timer
  24. font-size: 2rem
  25. </style>
  26. <script>
  27. import Timer from '@/components/Timer'
  28. export default {
  29. name: 'Objective',
  30. props: {
  31. objective: Object
  32. },
  33. data () {
  34. return {
  35. }
  36. },
  37. methods: {
  38. clearObjective: function () {
  39. if (this.$refs.timer.currentTime === 0) {
  40. this.resetTimer()
  41. }
  42. },
  43. forceClearObjective: function () {
  44. this.resetTimer()
  45. },
  46. resetTimer: function () {
  47. this.$refs.timer.setTime(this.objective.respawnTime)
  48. this.$refs.timer.startTimer()
  49. }
  50. },
  51. components: {
  52. Timer
  53. }
  54. }
  55. </script>