v-for 里有click 并没有用到事件代理, react 是合成事件并代理到 document上
Promise.retry = async function(fn, num){ return new Promise(function(resolve, reject){ while(num>0){ try{ const res = await fn resolve(res) num = 0 } catch(e){ if(!num) reject(e) } num -- } }) }
Just another site
v-for 里有click 并没有用到事件代理, react 是合成事件并代理到 document上
Promise.retry = async function(fn, num){ return new Promise(function(resolve, reject){ while(num>0){ try{ const res = await fn resolve(res) num = 0 } catch(e){ if(!num) reject(e) } num -- } }) }