I'm trying to embed a script from an external JS, according to the documentation and this post (Include external javascript file in a nuxt.js page) I have something like the following...
<template>
<div>
<blocksurvey-widget>
some details
</blocksurvey-widget>
</div>
</template>
export default {
head: {
script: [
{
type: "module",
src: "https://blocksurvey.io/assets/js/blocksurvey-widget.js",
},
],
},
}
I am wondering why this is not working and throws the [Vue-warn] error:
Unknown custom element: <blocksurvey-widget> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
I believe the script is appended to the head, and I think I need to register the component, but I had the impression this would be working normally once the script has been added. Do I have find some way to add the <blocksurvey-widget> component?
blocksurvey-widgeta local js file and placing it in an assets folder. Then in your Vue file import it:import { BlockSurveyWidget } from 'path-to-assets/blocksurvey-widget.js'; Then you can registerBlockSurveyWidget` in the script tag components: {} as suggested by gijoe.