App.vue 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <template>
  2. <v-app>
  3. <v-app-bar
  4. app
  5. color="white"
  6. elevate-on-scroll
  7. >
  8. <v-app-bar-nav-icon @click.stop="drawer = !drawer"/>
  9. <v-toolbar-title><strong>JVVM</strong></v-toolbar-title>
  10. </v-app-bar>
  11. <v-content>
  12. </v-content>
  13. <v-navigation-drawer
  14. v-model="drawer"
  15. app
  16. >
  17. <v-list subheader>
  18. <v-subheader>Java</v-subheader>
  19. <v-list-item link>
  20. <v-list-item-action>
  21. <v-icon>mdi-code</v-icon>
  22. </v-list-item-action>
  23. <v-list-item-content>
  24. <v-list-item-title>Home</v-list-item-title>
  25. </v-list-item-content>
  26. </v-list-item>
  27. <v-list-item link>
  28. <v-list-item-action>
  29. <v-icon>mdi-mail</v-icon>
  30. </v-list-item-action>
  31. <v-list-item-content>
  32. <v-list-item-title>Contact</v-list-item-title>
  33. </v-list-item-content>
  34. </v-list-item>
  35. </v-list>
  36. </v-navigation-drawer>
  37. <v-content class="pt-0">
  38. <v-container fluid>
  39. <j-v-v-m :state="currentState" :current-state-index="currentStateIndex"
  40. :total-state-length="states.length" @onNextFrame="handleNextFrame"
  41. @onPreFrame="handlePreFrame"
  42. ></j-v-v-m>
  43. </v-container>
  44. </v-content>
  45. </v-app>
  46. </template>
  47. <script>
  48. import JVVM from '@/views/JVVM'
  49. export default {
  50. name: 'App',
  51. components: { JVVM },
  52. data () {
  53. return {
  54. drawer: false,
  55. states: [],
  56. currentStateIndex: 0,
  57. currentState: {}
  58. }
  59. },
  60. mounted () {
  61. import('@/assets/jvm-data/out1.json').then(states => {
  62. const dataList = states.default
  63. if (dataList && dataList.length > 0) {
  64. this.currentState = dataList[0]
  65. }
  66. this.states = states
  67. })
  68. },
  69. methods: {
  70. handleNextFrame() {
  71. if (this.currentStateIndex < this.states.length - 1) {
  72. this.currentState = this.states[this.currentStateIndex + 1]
  73. this.currentStateIndex++
  74. }
  75. },
  76. handlePreFrame() {
  77. if (this.currentStateIndex > 0) {
  78. this.currentState = this.states[this.currentStateIndex - 1]
  79. this.currentStateIndex--
  80. }
  81. }
  82. }
  83. }
  84. </script>
  85. <style lang="scss">
  86. </style>