小编Moh*_*ran的帖子

无法将 npm 包添加到 nuxt js [vue-star-rating]

我是 nuxt js 的新手,所以当我尝试添加 npm 包时,它不起作用,这些都是试验。

星雨.js

import Vue from 'vue'
import StarsRatings from 'vue-star-rating'
Vue.use(StarsRatings)
Run Code Online (Sandbox Code Playgroud)

nuxt.config.js

    plugins: [{ src: '~/plugins/star-rating.js', mode: 'client' }],
    build: {
    /*
     ** You can extend webpack config here
     */
    extend(config, ctx) {},
    transpile: ['star-rating']
  }
Run Code Online (Sandbox Code Playgroud)

它显示了这些错误

[Vue warn]: The client-side rendered virtual DOM tree is not matching server-rendered content. This 
is likely caused by incorrect HTML markup, for example nesting block-level elements inside <p>, or 
missing <tbody>. Bailing hydration and performing full client-side render. …
Run Code Online (Sandbox Code Playgroud)

javascript plugins npm vue.js nuxt.js

2
推荐指数
1
解决办法
1118
查看次数

标签 统计

javascript ×1

npm ×1

nuxt.js ×1

plugins ×1

vue.js ×1