@@ -22,10 +22,9 @@ const {
2222 getPageSrc
2323} = require ( './util' )
2424
25- function createSlotsWxml ( emitFile , slots ) {
26- cacheSlots ( slots )
27- const allSlots = getSlots ( )
28- const content = Object . keys ( allSlots ) . map ( v => allSlots [ v ] . code ) . join ( '\n' )
25+ function createSlotsWxml ( emitFile , slots , importCode ) {
26+ cacheSlots ( slots , importCode )
27+ const content = getSlots ( )
2928 if ( content . trim ( ) ) {
3029 emitFile ( 'components/slots.wxml' , htmlBeautify ( content ) )
3130 }
@@ -34,11 +33,11 @@ function createSlotsWxml (emitFile, slots) {
3433// 调用 compiler 生成 wxml
3534function genComponentWxml ( compiled , options , emitFile , emitError , emitWarning ) {
3635 options . components [ 'slots' ] = { src : 'slots' , name : 'slots' }
37- const { code : wxmlCodeStr , compiled : cp , slots } = compiler . compileToWxml ( compiled , options )
36+ const { code : wxmlCodeStr , compiled : cp , slots, importCode } = compiler . compileToWxml ( compiled , options )
3837 const { mpErrors, mpTips } = cp
3938
4039 // 缓存 slots,延迟编译
41- createSlotsWxml ( emitFile , slots )
40+ createSlotsWxml ( emitFile , slots , importCode )
4241
4342 if ( mpErrors && mpErrors . length ) {
4443 emitError (
0 commit comments