Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NuxtJs使用时,提示【self is not defined】 #510

Open
ColaYuan opened this issue Oct 25, 2023 · 1 comment
Open

NuxtJs使用时,提示【self is not defined】 #510

ColaYuan opened this issue Oct 25, 2023 · 1 comment

Comments

@ColaYuan
Copy link

image

@sinedie
Copy link

sinedie commented Jan 17, 2024

When using echarts-gl, (in nextjs), need to import dymamicly.

I use a single file with a chart-utility-component and imports this file dynamicly at runtime.

Inside this file, imports of echarts-gl are as the docs says.

import * as echarts from 'echarts';
import 'echarts-gl';
...

export default function Echart({mergeOptions, options, width, hegiht, onInit}) {
 // here initialize the charts and handle all update chart logic
}
const Echart = dynamic(() => import('@/components/plots/Echart'), {
  loading: () => <Loading />,
  ssr: false,
});
...

<Echart ... />

This is in react, not vue but maybe vue has a similar capability

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants