vue.jsnuxt.js

Cannot use vue-start-rating in nuxt.js?


Cannot Used vue-star-rating in nuxt.js ReferenceError document is not defined

<template>
      <star-rating v-model="rating"></star-rating>
</template>

import StarRating from "vue-star-rating";
    export default {
      components: {
        StarRating
      }
    }

thi is my codesandbox


Solution

  • Currently vue-star-rating does not support SSR, however, there is a feature-request open for this.

    Currently, the only way to get this working with nuxt is to downgrade vue-star-rating to 1.6.2 and wrap it in no-ssr tags,

    <no-ssr>
      <star-rating :rating="3"></star-rating>
    </no-ssr>