We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2905ef5 commit 9f157b6Copy full SHA for 9f157b6
lib/mp-compiler/index.js
@@ -22,11 +22,20 @@ const {
22
getPageSrc
23
} = require('./util')
24
25
+let emitFileTimer = null
26
+
27
function createSlotsWxml (emitFile, slots, importCode) {
28
cacheSlots(slots, importCode)
29
const content = getSlots()
30
+ // 100 delay 比较符合当前策略
31
+ const delay = 100
32
if (content.trim()) {
- emitFile('components/slots.wxml', htmlBeautify(content))
33
+ if (emitFileTimer) {
34
+ clearTimeout(emitFileTimer)
35
+ }
36
+ emitFileTimer = setTimeout(function () {
37
+ emitFile('components/slots.wxml', htmlBeautify(content))
38
+ }, delay)
39
}
40
41
0 commit comments