I'm trying to add a Survey.js survey to a Nuxt project. I'm adding the external resources as per the official documentation
<template>
<div class="container">
<div id="surveyContainer"><survey :survey="survey"></survey></div>
</div>
</template>
<script>
export default {
head() {
return {
script: [
{
src: "https://surveyjs.azureedge.net/1.7.27/survey.vue.min.js"
}
],
link: [
{
rel: "stylesheet",
href: "https://surveyjs.azureedge.net/1.7.27/survey.css"
}
]
};
},
mounted() {
var surveyJSON = { /* json data */ };
function sendDataToServer(survey) {
//send Ajax request to your web server.
alert("The results are:" + JSON.stringify(survey.data));
}
var survey = new Survey.Model(surveyJSON);
new Vue({ el: "#surveyContainer", data: { survey: survey } });
}
};
</script>
This gives me:
ReferenceError: Survey is not defined
So somehow the js included in the head() is not available in mounted() it seems. I'm new to both Nuxt and Survey.js, so I'm not sure. Anyone who can help?