Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/codegen/customBlocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const { attrsToQuery } = require('./utils')

module.exports = function genCustomBlocksCode (
blocks,
id,
resourcePath,
resourceQuery,
stringifyRequest
Expand All @@ -12,7 +13,8 @@ module.exports = function genCustomBlocksCode (
const attrsQuery = attrsToQuery(block.attrs)
const issuerQuery = block.attrs.src ? `&issuerPath=${qs.escape(resourcePath)}` : ''
const inheritQuery = resourceQuery ? `&${resourceQuery.slice(1)}` : ''
const query = `?vue&type=custom&index=${i}&blockType=${qs.escape(block.type)}${issuerQuery}${attrsQuery}${inheritQuery}`
const idQuery = `&id=${id}`
const query = `?vue&type=custom&index=${i}${idQuery}&blockType=${qs.escape(block.type)}${issuerQuery}${attrsQuery}${inheritQuery}`
return (
`import block${i} from ${stringifyRequest(src + query)}\n` +
`if (typeof block${i} === 'function') block${i}(component)`
Expand Down
1 change: 1 addition & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ var component = normalizer(
if (descriptor.customBlocks && descriptor.customBlocks.length) {
code += genCustomBlocksCode(
descriptor.customBlocks,
id,
resourcePath,
resourceQuery,
stringifyRequest
Expand Down