diff --git a/src/index.ts b/src/index.ts index 86c612e..3fd8850 100644 --- a/src/index.ts +++ b/src/index.ts @@ -478,16 +478,19 @@ export default function vue(opts: Partial = {}): Plugin { descriptor.customBlocks.forEach((block, index) => { if (!isAllowed(block.type)) return + const vuePartRequest = createVuePartRequest( + filename, + (typeof block.attrs.lang === 'string' && block.attrs.lang) || + createVuePartRequest.defaultLang[block.type], + 'customBlocks', + index, + block.type + ) result.code += '\n' + - `export * from '${createVuePartRequest( - filename, - (typeof block.attrs.lang === 'string' && block.attrs.lang) || - createVuePartRequest.defaultLang[block.type] || - block.type, - 'customBlocks', - index - )}'` + `export * from '${vuePartRequest}'\n` + + `import __custom_block_${index}__ from '${vuePartRequest}'\n` + + `__custom_block_${index}__(__vue_component__)` }) dT( diff --git a/src/utils.ts b/src/utils.ts index 82bd16d..a17af10 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -22,7 +22,13 @@ export interface VuePartRequestMeta { } export interface VuePartRequestCreator { - (filename: string, lang: string, type: string, index?: number): string + ( + filename: string, + lang: string, + type: string, + index?: number, + blockType?: string + ): string defaultLang: { [key: string]: string @@ -68,7 +74,8 @@ export const createVuePartRequest: VuePartRequestCreator = (( filename: string, lang: string | undefined, type: string, - index?: number + index?: number, + blockType?: string ): string => { lang = lang || createVuePartRequest.defaultLang[type] @@ -76,7 +83,7 @@ export const createVuePartRequest: VuePartRequestCreator = (( const query = match ? queryString.parse(match[2]) : {} - query[PARAM_NAME] = [type, index, lang] + query[PARAM_NAME] = [type, index, blockType, lang] .filter(it => it !== undefined) .join('.') pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy