nuke-pi-loader
v0.1.3
Published
nuke pageinit loader
Downloads
6
Readme
简述
- PI-loader (Page Init loader) 为店铺页面启动脚本,其中主要处理了加载PI和页面依赖,页面数据的处理
- 依赖于PI能力组件:http://gitlab.alibaba-inc.com/rax/rax-nuke-pageinit(version: 0.0.1)
- 本组件是提供给业务方配置和调用;实现了根据业务域的CDN地址来加载对应的依赖组件,实现zcache;
实现说明
功能说明
- 支持beforeRender和afterRender 自定义函数的调用
- 支持业务域自定义错误页面的挂载
业务上使用指南
- h5端PI生成:
import webEntry from '@ali/nuke-pi-loader/web.entry.js';
import BizErrorPage from '../../components/biz-error-page';
import BizLoadingPage from '../../components/biz-loading';
webEntry({
container: document.getElementById('container'),
secondModuleDomain: 'https://g.alicdn.com/',
thirdModuleDomain: 'https://shopmod.alicdn.com/res/mod/shopmod-release/',
goldlogKey: '/tbwmdd.66.1',
beforeRender: function(){console.log('beforeRender');},
afterRender: function(){console.log('afterRender');},
errorPic: 'https://img.alicdn.com/tfs/TB1Hh2cQFXXXXbOXFXXXXXXXXXX-220-220.png',
loadingText: 'loading...',
loadingPic: 'https://gw.alicdn.com/tfs/TB19i5rawnD8KJjy1XdXXaZsVXa-128-128.png',
bizErrorPage: BizErrorPage,
bizLoadingPage: BizLoadingPage,
bizLib: {
packageName: 'npm/@ali/rax-ae-wl-module-lib/index',
cdnPath: 'aemod/ae-wl-module-lib/0.0.1/index.weex.cmd.js',
},
logger: {
pid: 'a1huy9hr07@8a148d69af6656e',
imgUrl: 'https://arms-retcode.aliyuncs.com/r.png?',
},
apiUrl: 'https://campaign.alicdn.com/pagedata/shop/index?pathInfo=shop/index&userId=2260305104&shopId=114409787&pageId=109016069',
});
- native端PI生成:
import nativeEntry from '@ali/rax-pi-loader/native.entry.js';
import BizErrorPage from '../../components/biz-error-page';
import BizLoadingPage from '../../components/biz-loading';
nativeEntry({
secondModuleDomain: 'https://g.alicdn.com/',
thirdModuleDomain: 'https://shopmod.alicdn.com/res/mod/shopmod-release/',
goldlogKey: '/tbwmdd.66.1',
beforeRender: function(){console.log('beforeRender');},
afterRender: function(){console.log('afterRender');},
errorPic: 'https://img.alicdn.com/tfs/TB1Hh2cQFXXXXbOXFXXXXXXXXXX-220-220.png',
loadingText: 'loading...',
loadingPic: 'https://gw.alicdn.com/tfs/TB19i5rawnD8KJjy1XdXXaZsVXa-128-128.png',
bizErrorPage: BizErrorPage,
bizLoadingPage: BizLoadingPage,
bizLib: {
packageName: 'npm/@ali/rax-ae-wl-module-lib/index',
cdnPath: 'aemod/ae-wl-module-lib/0.0.1/index.weex.cmd.js',
},
logger: {
pid: 'a1huy9hr07@8a148d69af6656e',
imgUrl: 'https://arms-retcode.aliyuncs.com/r.png?',
},
apiUrl: 'https://campaign.alicdn.com/pagedata/shop/index?pathInfo=shop/index&userId=2260305104&shopId=114409787&pageId=109016069',
});
以上代码打包后,即可得到代码,在对应的vm中使用