SEPTA transit board for me
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
823 B

6 years ago
6 years ago
6 years ago
6 years ago
  1. <template>
  2. <div id="app">
  3. <section>
  4. <h1>Transit Board</h1>
  5. <p>
  6. {{ now.getHours() }}:{{ now.getMinutes() }}:{{ now.getSeconds() }}
  7. </p>
  8. </section>
  9. <section>
  10. <button v-on:click="test">Test</button>
  11. <h2>🚌 45</h2>
  12. <ul>
  13. <li v-for="arrival in bus" v-bind:key="arrival.trip">
  14. {{ arrival.Direction }}, {{ arrival.late }} minutes late
  15. </li>
  16. </ul>
  17. </section>
  18. </div>
  19. </template>
  20. <script>
  21. export default {
  22. name: 'app',
  23. data: function () {
  24. return {
  25. now: new Date(),
  26. bus: []
  27. }
  28. },
  29. methods: {
  30. test: function () {
  31. this.$http.get('/test_45_0.json').then(response => {
  32. this.bus = response.body.bus
  33. })
  34. }
  35. },
  36. created () {
  37. setInterval(() => {
  38. this.now = new Date()
  39. }, 1000)
  40. }
  41. }
  42. </script>
  43. <style>
  44. </style>