kingyue737 / nuxt-echarts

Nuxt module for Apache ECharts™
https://echarts.nuxt.dev
MIT License
49 stars 4 forks source link

Docs need plain client side example #6

Closed BenJackGill closed 2 months ago

BenJackGill commented 2 months ago

Lots of good examples in the demo and on Github for different SSR scenarios, but none for a plain standard client side setup. Would be good to see the idiomatic way of doing that.

kingyue737 commented 2 months ago

When you turn off ssr option (which is not enabled by default) in the module config, <VChart> will become a plain client chart. Whether you turn on SSR or not, the usage of <VChart> is the same except that you don't need to assign an initial size when SSR is off. The initial size is only required in SSR.

//nuxt.config.ts
export default defineNuxtConfig({
  modules: ['nuxt-echarts'],
  echarts: {
-    ssr: true,
  },
})

The bar chart in the demo is based on <VChart>.

kingyue737 commented 2 months ago

Here is also another example. I use client-only <VChart> in this starter template.

https://github.com/kingyue737/vitify-nuxt/blob/main/pages/dashboard.vue