11 2018 档案
摘要:export const ERROR_PROMISE_TIMEOUT = 'ERROR_PROMISE_TIMEOUT'; export default function (promise, timeout) { let timer = undefined; return Promise.race([ new Promise(function (resolve, reject)...
阅读全文
摘要:export default function (promiseProducer, params, interval, attemptTimes) { interval = typeof interval === "number" && interval >= 300 ? interval : 500; attemptTimes = typeof attemptTimes === "nu...
阅读全文
摘要:用循环遍历一棵树,需要借助一个栈,当栈为空时就遍历完了,栈里面存储下一个需要拷贝的节点 首先我们往栈里放入种子数据,key用来存储放哪一个父元素的那一个子元素拷贝对象 然后遍历当前节点下的子元素,如果是对象就放到栈里,否则直接拷贝
阅读全文
摘要:getPositionTop(node) { // 获取元素到顶部距离-通用方法 var top = node.offsetTop; var parent = node.offsetParent; while(parent != null) { top += parent.offsetTop; parent = parent.offsetP...
阅读全文