Vue2-datepicker: SSR

Created on 12 Jul 2018  路  7Comments  路  Source: mengxiong10/vue2-datepicker

Support for ssr is planned?

Most helpful comment

Also would love SSR support. It doesn't appear to be too difficult after scanning the codebase.

Meanwhile, for NUXT:

// plugins/datepicker.js
import DatePicker from 'vue2-datepicker'
import Vue from 'vue'

Vue.component('date-picker', DatePicker)
  // nuxt.config.js
  plugins: [
    { src: '~/plugins/datepicker', ssr: false }
  ],
// Component.vue
<template>
  <no-ssr>
    <date-picker />
  </no-ssr>
</template>

All 7 comments

Also would love SSR support. It doesn't appear to be too difficult after scanning the codebase.

Meanwhile, for NUXT:

// plugins/datepicker.js
import DatePicker from 'vue2-datepicker'
import Vue from 'vue'

Vue.component('date-picker', DatePicker)
  // nuxt.config.js
  plugins: [
    { src: '~/plugins/datepicker', ssr: false }
  ],
// Component.vue
<template>
  <no-ssr>
    <date-picker />
  </no-ssr>
</template>

Wow datepicker doesn't work in Node + ExpresJS because window is not defined.
How do I fix that?

@volokolamskspb you'd have to fork and fix the issue.

@antony good job

import Vue from 'vue'
import DatePicker from 'vue2-datepicker'
import 'vue2-datepicker/index.css';

Vue.use(DatePicker)

We might need index.css for styling too on plugins/datepicker.js

You definitely need index.css, or you get an SVG icon that fills up half your page, and no calendar.

Do we have any official fix for this amazing datepicker to work with nuxt?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

BuiHuyCuong picture BuiHuyCuong  路  5Comments

4spen picture 4spen  路  4Comments

kugatsu765 picture kugatsu765  路  3Comments

burzum picture burzum  路  3Comments

MaxDiMart picture MaxDiMart  路  5Comments