Update nuxt-primevue module

pull/5161/head
mertsincan 2024-01-24 12:08:37 +00:00
parent 2d09cbe43a
commit 393306a31e
1 changed files with 5 additions and 3 deletions

View File

@ -38,7 +38,7 @@ export default defineNuxtModule({
setup(moduleOptions, nuxt) { setup(moduleOptions, nuxt) {
const resolver = createResolver(import.meta.url); const resolver = createResolver(import.meta.url);
const registered = register(moduleOptions); const registered = register(moduleOptions);
const { importPT } = moduleOptions; const { importPT, options } = moduleOptions;
nuxt.options.runtimeConfig.public.primevue = { nuxt.options.runtimeConfig.public.primevue = {
...moduleOptions, ...moduleOptions,
@ -50,10 +50,12 @@ export default defineNuxtModule({
const styleContent = () => ` const styleContent = () => `
${registered.styles.map((style) => `import ${style.as} from '${style.from}';`).join('\n')} ${registered.styles.map((style) => `import ${style.as} from '${style.from}';`).join('\n')}
const styleProps = {
${options?.csp?.nonce ? `nonce: ${options?.csp?.nonce}` : ''}
}
const styles = [ const styles = [
${registered.injectStylesAsString.join('')}, ${registered.injectStylesAsString.join('')},
${registered.styles.map((item) => `${item.as} && ${item.as}.getStyleSheet ? ${item.as}.getStyleSheet() : ''`).join(',')} ${registered.styles.map((item) => `${item.as} && ${item.as}.getStyleSheet ? ${item.as}.getStyleSheet(undefined, styleProps) : ''`).join(',')}
].join(''); ].join('');
export { styles }; export { styles };