Activity plugin with single page application in view.php

Re: Activity plugin with single page application in view.php

by Benedikt Kulmann -
Number of replies: 0

Hi Jan,

thank you so much for your reply!

I do use git (both github and my private gitlab instance) on an everyday basis. No need to convince me. smile

With your advice I got a basic activity with vue.js running. There are still manual steps involved in deploying as .zip for plugin installation in moodle, but I explained that in the readme of the repo. Happy if you want to take a look yourself smile

https://github.com/kulmann/moodle-activity_vuetest


Mainly there were three steps involved:

1. I didn't know that you can include js with `$PAGE->requires->js()`, only saw `js_init()` etc through auto completion. Thus I didn't find a way to include javascript that executes itself. So a big thanks for that hint. wink

2. Looks like Vue.js needs to run inside a wrapper, I found this one: https://github.com/vuejs/vue-web-component-wrapper

3. Not yet sure about a better way, but I enabled the `abstract` router mode so that the actual urls in the browser won't be changed during navigation through the app. Maybe it is possible to work with moodle urls, but didn't find a way, yet. Default router replaces too much of the url.


Next issues will be incorporating i18n from moodle and whether or not it is possible to deliver the vue app through the mobile app (I have absolutely no experience on the latter). Then I will try to port one of our quiz game activities to vue.


Anyway, thanks again for your help!

Benedikt