Configuration
You can configure Nuxt TradingView with a few options.
By default, the module injects all widgets, but you can configure it to inject only the widgets you need. Additionally, you can add a prefix to widget component names to avoid conflicts with other local components.
prefix
To change default widget component names, you can add a prefix
into the tradingview
section to use every widget with that prefix
nuxt.config.ts
export default defineNuxtConfig({
tradingview: {
prefix: 'TV'
}
})
Then you can use the components as follows:
<template>
<TVChart />
<TVCryptoMarket />
<TVTopStories/>
<TVScreener/>
</template>
If
prefix
is not defined, you can use the components as shown in the documentation.importOnly
To reduce the bundle size, you can import only the widgets you need. Add an importOnly
parameter to the tradingview
section to inject only the widgets you need.
nuxt.config.ts
export default defineNuxtConfig({
tradingview: {
importOnly: ['Chart', 'CryptoMarket', 'TopStories', 'Screener']
}
})
Make sure to use the exact names of the widgets. Even if you define a
prefix
, you must use the default name of the widgets. You can find all widget names here.Table of Contents