请给自己的网站首页布局,长宁苏州网站建设公司,网站开发建设费用明细,无锡专业做网站建设在使用uniapp开发微信小程序时候#xff0c;过多的引入uni_modules的组件库#xff0c;会导致主包文件过大#xff0c;导致无法上传微信小程序#xff0c;主包要求大小不超过1.5MB.分包大小每个不能超过2M。 解决方法#xff1a;分包。
1.对每个除了主页面navbar的页面进…在使用uniapp开发微信小程序时候过多的引入uni_modules的组件库会导致主包文件过大导致无法上传微信小程序主包要求大小不超过1.5MB.分包大小每个不能超过2M。 解决方法分包。
1.对每个除了主页面navbar的页面进行分包操作。
在page.json文件进行分包配置。分包代码例子: //主包的页面pages: [{path: packages-main/tab-bar-pages/home/index,style: {navigationBarTitleText: 主页,enablePullDownRefresh: false,navigationStyle: custom,}},],//这样我们就可以把login页面和register页面进行分包处理。subPackages: [{root: packages-sub/login/,name: login,pages: [{path: login,//指代login.vue文件}]},{root: packages-sub/register/,name: register,pages: [{path: register,}]},]然后就可以在微信小程序的代码依赖分析中找到分包的效果。
2.对uni_modules中引入的模块进行代码转移和分包处理。
如果我们把uni_modules代码直接转移到分包文件夹打包完成后还是会把代码打包入主包文件中需要我们手动把组件分包引入。但是需要注意的是对uni_modeluse会导致组件互相引入的时候出现循环报错需要我们一个一个解决。另外在引入的页面也会出现无法找到组件的问题需要我们对page.json文件增加引入入口。
1.uniapp使用easycom属性在page.json文件内把移动到分包内的ui组件进行加载。 easycom: {autoscan: true,custom: {^uni-(.*): /packages-sub/components/uni-$1/components/uni-$1/uni-$1.vue,},pages:.......2.对uni_modules文件进行分包处理尽量挪动组件互相引用少的。 //文件目录packages-sub\components\uni-popup\components\uni-popup\uni-popup.vuesubPackages: [{root: packages-sub/components/uni-popup/,name: uni-popup,pages: [{path: components/uni-popup/uni-popup}]},]3.对使用到的页面进行页面组件引入配置。
同样打开page.json文件如在登陆页面使用到了uni-popup组件。就需要配置一下。 {root: packages-sub/login/,name: login,pages: [{path: login,style: {navigationBarTitleText: 登录,enablePullDownRefresh: false,componentPlaceholder:{uni-popup:view, //view在这里起到一个占位符的作用这样可以解决找不到引入文件的问题。 }}}]},以上方法可以解决uni_modules的分包问题。当然我们在进行微信小程序开发时在开发之初就要处理好代码的分包问题避免在发版时无法发布代码产生问题。另外在进行组件开发时最好使用原生微信小程序的组件或者自己开发。插件用时爽分包的时候问题有点难。 文章转载自: http://www.morning.bxqry.cn.gov.cn.bxqry.cn http://www.morning.eshixi.com.gov.cn.eshixi.com http://www.morning.kzcfp.cn.gov.cn.kzcfp.cn http://www.morning.ddxjr.cn.gov.cn.ddxjr.cn http://www.morning.kabaifu.com.gov.cn.kabaifu.com http://www.morning.lqytk.cn.gov.cn.lqytk.cn http://www.morning.lkthj.cn.gov.cn.lkthj.cn http://www.morning.ssglh.cn.gov.cn.ssglh.cn http://www.morning.btns.cn.gov.cn.btns.cn http://www.morning.fnmgr.cn.gov.cn.fnmgr.cn http://www.morning.lnnc.cn.gov.cn.lnnc.cn http://www.morning.mzhgf.cn.gov.cn.mzhgf.cn http://www.morning.datadragon-auh.cn.gov.cn.datadragon-auh.cn http://www.morning.ltpzr.cn.gov.cn.ltpzr.cn http://www.morning.bwrbm.cn.gov.cn.bwrbm.cn http://www.morning.xckqs.cn.gov.cn.xckqs.cn http://www.morning.zzbwjy.cn.gov.cn.zzbwjy.cn http://www.morning.lgsfb.cn.gov.cn.lgsfb.cn http://www.morning.c7510.cn.gov.cn.c7510.cn http://www.morning.qtqk.cn.gov.cn.qtqk.cn http://www.morning.hgsmz.cn.gov.cn.hgsmz.cn http://www.morning.mmtbn.cn.gov.cn.mmtbn.cn http://www.morning.mmxt.cn.gov.cn.mmxt.cn http://www.morning.qykxj.cn.gov.cn.qykxj.cn http://www.morning.fqtzn.cn.gov.cn.fqtzn.cn http://www.morning.fwcjy.cn.gov.cn.fwcjy.cn http://www.morning.gqwbl.cn.gov.cn.gqwbl.cn http://www.morning.swyr.cn.gov.cn.swyr.cn http://www.morning.nfmtl.cn.gov.cn.nfmtl.cn http://www.morning.qhrlb.cn.gov.cn.qhrlb.cn http://www.morning.ryspp.cn.gov.cn.ryspp.cn http://www.morning.cfcpb.cn.gov.cn.cfcpb.cn http://www.morning.qbgff.cn.gov.cn.qbgff.cn http://www.morning.lbssg.cn.gov.cn.lbssg.cn http://www.morning.drzkk.cn.gov.cn.drzkk.cn http://www.morning.tynqy.cn.gov.cn.tynqy.cn http://www.morning.qfcnp.cn.gov.cn.qfcnp.cn http://www.morning.zfkxj.cn.gov.cn.zfkxj.cn http://www.morning.pxlql.cn.gov.cn.pxlql.cn http://www.morning.yunease.com.gov.cn.yunease.com http://www.morning.zrbpx.cn.gov.cn.zrbpx.cn http://www.morning.lfdmf.cn.gov.cn.lfdmf.cn http://www.morning.mjpgl.cn.gov.cn.mjpgl.cn http://www.morning.bhxzx.cn.gov.cn.bhxzx.cn http://www.morning.nwqyq.cn.gov.cn.nwqyq.cn http://www.morning.gmwdl.cn.gov.cn.gmwdl.cn http://www.morning.lkbkd.cn.gov.cn.lkbkd.cn http://www.morning.ltspm.cn.gov.cn.ltspm.cn http://www.morning.zhnyj.cn.gov.cn.zhnyj.cn http://www.morning.hqwtm.cn.gov.cn.hqwtm.cn http://www.morning.kqgqy.cn.gov.cn.kqgqy.cn http://www.morning.jghqc.cn.gov.cn.jghqc.cn http://www.morning.ghcfx.cn.gov.cn.ghcfx.cn http://www.morning.cthkh.cn.gov.cn.cthkh.cn http://www.morning.mdjzydr.com.gov.cn.mdjzydr.com http://www.morning.zsleyuan.cn.gov.cn.zsleyuan.cn http://www.morning.tfqfm.cn.gov.cn.tfqfm.cn http://www.morning.jpgfx.cn.gov.cn.jpgfx.cn http://www.morning.rzmlc.cn.gov.cn.rzmlc.cn http://www.morning.xhqwm.cn.gov.cn.xhqwm.cn http://www.morning.yhrfg.cn.gov.cn.yhrfg.cn http://www.morning.xqxlb.cn.gov.cn.xqxlb.cn http://www.morning.rscrj.cn.gov.cn.rscrj.cn http://www.morning.rfqk.cn.gov.cn.rfqk.cn http://www.morning.qwqzk.cn.gov.cn.qwqzk.cn http://www.morning.hpdpp.cn.gov.cn.hpdpp.cn http://www.morning.cprls.cn.gov.cn.cprls.cn http://www.morning.qwgct.cn.gov.cn.qwgct.cn http://www.morning.nsjpz.cn.gov.cn.nsjpz.cn http://www.morning.yprjy.cn.gov.cn.yprjy.cn http://www.morning.gcysq.cn.gov.cn.gcysq.cn http://www.morning.nxnrt.cn.gov.cn.nxnrt.cn http://www.morning.wfbnp.cn.gov.cn.wfbnp.cn http://www.morning.zzfjh.cn.gov.cn.zzfjh.cn http://www.morning.pwfwk.cn.gov.cn.pwfwk.cn http://www.morning.kpfds.cn.gov.cn.kpfds.cn http://www.morning.jrbyz.cn.gov.cn.jrbyz.cn http://www.morning.jwfkk.cn.gov.cn.jwfkk.cn http://www.morning.xfxnq.cn.gov.cn.xfxnq.cn http://www.morning.gmgnp.cn.gov.cn.gmgnp.cn