This demo shows how to add SurveyJS Form Builder / Survey Creator to a Nuxt application.
git clone https://github.com/surveyjs/surveyjs-nuxtjs.git
cd surveyjs-nuxtjs
npm i
npm run devOpen http://localhost:3000 in your web browser.
-
Install the
survey-creator-vuenpm package:npm install survey-creator-vue --save
-
Create a file in the
pluginsdirectory and install SurveyJS Vue plugins in this file using thenuxtApp.vueApp.use()method. -
Open the
next.config.tsfile and do the following in it:- List the plugin file in the
pluginsarray. - List SurveyJS style sheets in the
cssarray.
- List the plugin file in the
-
Create a component and configure Survey Creator in it (see the
components/SurveyCreator.vuefile). -
Add the component to a page (see the
app.vuefile). In this example, the component is wrapped in the<ClientOnly>tag because Survey Creator useslocalStorageto save and restore survey JSON schemas. If your application doesn't use this functionality, you can render Survey Creator on the server.