Skip to content

Commit

Permalink
Merge pull request #13 from mpvue/develop
Browse files Browse the repository at this point in the history
更新slots生成机制, 规避emitFile策略造成的问题
  • Loading branch information
aOrz authored Apr 27, 2018
2 parents ec131ab + 9f157b6 commit 72b93f2
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/mp-compiler/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,20 @@ const {
getPageSrc
} = require('./util')

let emitFileTimer = null

function createSlotsWxml (emitFile, slots, importCode) {
cacheSlots(slots, importCode)
const content = getSlots()
// 100 delay 比较符合当前策略
const delay = 100
if (content.trim()) {
emitFile('components/slots.wxml', htmlBeautify(content))
if (emitFileTimer) {
clearTimeout(emitFileTimer)
}
emitFileTimer = setTimeout(function () {
emitFile('components/slots.wxml', htmlBeautify(content))
}, delay)
}
}

Expand Down

0 comments on commit 72b93f2

Please sign in to comment.