Search code examples
vue.jsnuxt.jsvuetify.jsdynamic-forms

vuetify-form-base Form not Load in Production Mode


I Use vuetify-form-base in Nuxt-Vue project and evrythings is OK in development mode(npm run dev) When I switch to production mode(npm run start); forms not load and no errors or warnings occurred.

my nuxt.config.js file is:

import colors from 'vuetify/es5/util/colors'

export default {
  ssr: false,
  head: {
    titleTemplate: '%s - nuxt-form-sample',
    title: 'nuxt-form-sample',
    htmlAttrs: {
      lang: 'en'
    },
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { hid: 'description', name: 'description', content: '' }
    ],
    link: [
      { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
    ]
  },
  components: true,
  buildModules: [
    '@nuxtjs/vuetify',
  ],
  vuetify: {
    customVariables: ['~/assets/variables.scss'],
    theme: {
      dark: true,
      themes: {
        dark: {
          primary: colors.blue.darken2,
          accent: colors.grey.darken3,
          secondary: colors.amber.darken3,
          info: colors.teal.lighten1,
          warning: colors.amber.base,
          error: colors.deepOrange.accent4,
          success: colors.green.accent3
        }
      }
    }
  }
}

and vuetify-form-base usage is:

<div>
  <v-form-base :schema="schema" :model="model"/>
</div>

Solution

  • I solved this issue https://github.com/wotamann/vuetify-form-base/issues/50 In the SSR mode form didn't render correctly!

    Solution1:

    You should use the 'v-mask' package and import the main component file in the vuetify-form-base package.

    You should export this package in a plugin like as below: Vue.component('VueMask', () => import('v-mask'))

    after that add the main file component to your project:

    https://github.com/wotamann/vuetify-form-base/blob/master/dist/src/vFormBase.vue

    Alternative solution: