欢迎进入广州凡科互联网科技有限公司网站
全国服务热线
4000-399-000
微信小程序框架_vue.js源代码core scedule.js学习笔记
时间: 2021-01-11 16:34 浏览次数:
vue.js源码core scedule.js学习培训手记 本文关键为大伙儿详尽详细介绍了vue.js源码core scedule.js的学习培训手记,具备一定的参照使用价值,很感兴趣的小伙子伴们能够参照一下// This
vue.js源代码core scedule.js学习笔记       这篇文章主要为大家详细介绍了vue.js源代码core scedule.js的学习笔记,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
// This ensures that: // 1. Components are updated from parent to child. (because parent is always // created before the child) // 2. A component's user watchers are run before its render watcher (because // user watchers are created before the render watcher) // 3. ponent is destroyed during ponent's watcher run, // its watchers can be skipped. queue.sort((a, b) = a.id - b.id) // do not cache length because more watchers might be pushed // as we run existing watchers for (index = 0; index queue.length; index++) { watcher = queue[index] id = watcher.id has[id] = null watcher.run() // in dev build, check and stop circular updates. if (process.env.NODE_ENV !== 'production' has[id] != null) { circular[id] = (circular[id] || 0) + 1 if (circular[id] config._maxUpdateCount) { warn( 'You may have an infinite update loop ' + ( watcher.user `in watcher with expression "${watcher.expression}"` : `ponent render function.` watcher.vm break // reset scheduler before updated hook called const oldQueue = queue.slice() resetSchedulerState() // call updated hooks index = oldQueue.length while (index--) { watcher = oldQueue[index] vm = watcher.vm if (vm._watcher === watcher vm._isMounted) { callHook(vm, 'updated') // devtool hook /* istanbul ignore if */ if (devtools config.devtools) { devtools.emit('flush') * Push a watcher into the watcher queue. * Jobs with duplicate IDs will be skipped unless it's * pushed when the queue is being flushed. export function queueWatcher (watcher: Watcher) { const id = watcher.id if (has[id] == null) { has[id] = true if (!flushing) { queue.push(watcher) } else { // if already flushing, splice the watcher based on its id // if already past its id, it will be run next immediately. let i = queue.length - 1 while (i = 0 queue[i].id watcher.id) { queue.splice(Math.max(i, index) + 1, 0, watcher) // queue the flush if (!waiting) { waiting = true nextTick(flushSchedulerQueue)

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持凡科。




Copyright © 广州凡科互联网科技有限公司 版权所有 粤ICP备10235580号
全国服务电话:4000-399-000   传真:021-45545458
公司地址:广州市海珠区工业大道北67号凤凰创意园