Demo entry 6763700

test

   

Submitted by anonymous on Oct 25, 2018 at 03:46
Language: JavaScript. Code size: 498 Bytes.

//懒加载函数
function loadPage (navigator, name) {
    if (!route.hasRoute(name)) {
        let map = {
            'page1': 'business1',       // 业务包1  
            'page2': 'business1',      // 业务包2
            'page3': 'business2'      // 业务包3
        };
        
        // 路由加载
        NativeModules.RNDynamic.loadJSBundle(map[name]).finally(() => {  
            navigator.push(route.getRoute(name))
        });
        return;
    }

    navigator.push(route.getRoute(name));
}

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).