- 把非首屏的组件变成异步组件,异步加载。
//Ensure a function is called only once
function once(fn:Function): Function{
let called = false;
return function(){
if(!called){
called = true;
fn.apply(this,arguments)
}
}
}