我是 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)