_template.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <template>
  2. <ExperimentBlock
  3. :experiment-name="experimentName"
  4. :scene-name="sceneName"
  5. :loading-message="loadingMessage"
  6. :loading-error-message="loadingErrorMessage"
  7. >
  8. <template v-slot:header>
  9. <!-- ## Template to place in the header (example: Extract-configurator) ## -->
  10. </template>
  11. <template v-slot:content>
  12. <!-- ## Actual experiment template ## -->
  13. </template>
  14. </ExperimentBlock>
  15. </template>
  16. <script>
  17. import ExperimentBlock from '@/components/ExperimentBlock.vue'
  18. import ExperimentBase from '@/mixins/ExperimentBase'
  19. import { mapActions } from 'vuex'
  20. export default {
  21. components: {
  22. ExperimentBlock
  23. },
  24. mixins: [ExperimentBase],
  25. data() {
  26. return {}
  27. },
  28. // When experiment is loaded, this function is ran
  29. async mounted() {
  30. // Load config and progress for this scene to local state
  31. this.loadConfig()
  32. this.loadProgress()
  33. // ## Do your experiment initialization stuff here ##
  34. this.loadingMessage = 'Loading experiment data...'
  35. this.loadingErrorMessage = null
  36. try {
  37. // Load scene qualities list
  38. await this.getQualitiesList()
  39. }
  40. catch (err) {
  41. console.error(err)
  42. this.loadingErrorMessage = err.message
  43. return
  44. }
  45. finally {
  46. this.loadingMessage = null
  47. }
  48. // ##/ Do your experiment initialization stuff here ##
  49. // Save progress from local state into store
  50. this.saveProgress()
  51. },
  52. // List of experiment-specific methods
  53. methods: {
  54. ...mapActions(['loadScenesList'])
  55. }
  56. }
  57. </script>
  58. <style scoped>
  59. /* Experiment-specific style (CSS) */
  60. </style>