V-calendar: Nuxt.js helpers integration

Created on 28 Apr 2018  路  6Comments  路  Source: nathanreyes/v-calendar

I am having issues integrating with Nuxt. Currently, I added it as a plugin in the build, but it's throwing an error when I try using v-date-picker.

[Vue warn]: Unknown custom element: <v-date-picker> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

found in

---> <SmallComponent> at components/smallCalendar.vue
       <NoSsr>
         <Homepage> at pages/homepage.vue
           <Nuxt>
             <Default> at layouts/default.vue
               <Root>

Apparently it's failing to recognise the children components of the package. Any idea how can I fix it?

Most helpful comment

I'm able to use the plugin on the landing page, which is running on nuxt at the moment.

Is something like the following in your nuxt.config.js?

  plugins: [{ src: '~/plugins/v-calendar', ssr: false }],

...with the following in v-calendar.js

import Vue from 'vue';
import VCalendar from 'v-calendar';
Vue.use(VCalendar);

..then when using you need to wrap in <no-ssr> tags, which it looks like you are doing already.

All 6 comments

I'm able to use the plugin on the landing page, which is running on nuxt at the moment.

Is something like the following in your nuxt.config.js?

  plugins: [{ src: '~/plugins/v-calendar', ssr: false }],

...with the following in v-calendar.js

import Vue from 'vue';
import VCalendar from 'v-calendar';
Vue.use(VCalendar);

..then when using you need to wrap in <no-ssr> tags, which it looks like you are doing already.

That is exactly what I've used, but the error is shown when I use v-date-picker.

@Erigers did you got it working? For me its the same, have no idea why.

forgett it, I needed to restart nuxt for some reason.

I hope this post helps.
https://medium.com/@Dongmin_Jang/nuxtjs-how-to-set-v-calendar-c1bbd75af7b5

I temporarily fixed it. Here are my relavant files:
In the plugins/v-date-picker.js:

import Vue from 'vue';
import VDatePicker from 'v-calendar/lib/components/date-picker.umd';
Vue.component('v-date-picker', VDatePicker)

In the nuxt.config.js:

{
  src: "@/plugins/v-date-picker",
  ssr: false
},

and then I used <v-date-picker> tag inside <no-ssr> or <client-only> tags:

<no-ssr>
  <div>
    <v-date-picker
      v-model='quoteField.moveDate'
      mode='single'
      is-required
      :input-props="{
                    placeholder: 'Please select your pickup date.',
                    id: 'pickup-date',
                    required: true,
                    }"
      />
  </div>
</no-ssr>
Was this page helpful?
0 / 5 - 0 ratings

Related issues

nik736 picture nik736  路  3Comments

Maadtin picture Maadtin  路  3Comments

redraw picture redraw  路  3Comments

Nadavrbn picture Nadavrbn  路  3Comments

felixfrtz picture felixfrtz  路  3Comments