@@ -22,10 +22,9 @@ const {
22
22
getPageSrc
23
23
} = require ( './util' )
24
24
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 ( )
29
28
if ( content . trim ( ) ) {
30
29
emitFile ( 'components/slots.wxml' , htmlBeautify ( content ) )
31
30
}
@@ -34,11 +33,11 @@ function createSlotsWxml (emitFile, slots) {
34
33
// 调用 compiler 生成 wxml
35
34
function genComponentWxml ( compiled , options , emitFile , emitError , emitWarning ) {
36
35
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 )
38
37
const { mpErrors, mpTips } = cp
39
38
40
39
// 缓存 slots,延迟编译
41
- createSlotsWxml ( emitFile , slots )
40
+ createSlotsWxml ( emitFile , slots , importCode )
42
41
43
42
if ( mpErrors && mpErrors . length ) {
44
43
emitError (
0 commit comments