Nuxt 插件在构建后不工作(使用 apexchart)
Nuxt Plugins not working after build ( use apexchart )
我在nuxt中使用apex图表
并使用我的代码应用插件
这在开发模式下工作
cross-env NODE_ENV=development HOST=0.0.0.0 PORT=3000 nodemon server/index.js --watch server
但无法在构建源代码中工作
nuxt build && cross-env NODE_ENV=production HOST=0.0.0.0 PORT=80 node server/index.js
这是我的代码
plugins/vue-apexchar.js
import Vue from 'vue'
import VueApexCharts from 'vue-apexcharts'
Vue.component('VueApexCharts', VueApexCharts);
nuxt.config.js
plugins: [
{ src : '~/plugins/vue-apexchart.js', ssr : false },
],
build: {
vendor : [
'vue-apexchart'
]
}
weekChart.vue
<VueApexCharts max-width="300" type="area" :options="chartOptions" :series="series"></VueApexCharts>
这些代码在开发模式下工作但不能工作构建文件
我需要你的帮助来解决这个问题
请帮我
这是我的源代码 > https://github.com/zoz0312/Nuxt_Blog
<client-only>
<MY COMPONENT/>
</client-only>
使用 'client-only' 标签解决了这个问题
"This component is used to purposely render a component only on client-side."
我的插件只在客户端工作,所以使用那个标签,我可以解决这个问题
我在nuxt中使用apex图表
并使用我的代码应用插件
这在开发模式下工作
cross-env NODE_ENV=development HOST=0.0.0.0 PORT=3000 nodemon server/index.js --watch server
但无法在构建源代码中工作
nuxt build && cross-env NODE_ENV=production HOST=0.0.0.0 PORT=80 node server/index.js
这是我的代码
plugins/vue-apexchar.js
import Vue from 'vue'
import VueApexCharts from 'vue-apexcharts'
Vue.component('VueApexCharts', VueApexCharts);
nuxt.config.js
plugins: [
{ src : '~/plugins/vue-apexchart.js', ssr : false },
],
build: {
vendor : [
'vue-apexchart'
]
}
weekChart.vue
<VueApexCharts max-width="300" type="area" :options="chartOptions" :series="series"></VueApexCharts>
这些代码在开发模式下工作但不能工作构建文件
我需要你的帮助来解决这个问题
请帮我
这是我的源代码 > https://github.com/zoz0312/Nuxt_Blog
<client-only>
<MY COMPONENT/>
</client-only>
使用 'client-only' 标签解决了这个问题
"This component is used to purposely render a component only on client-side."
我的插件只在客户端工作,所以使用那个标签,我可以解决这个问题