h5打包
打包前配置
![](https://img-blog.csdnimg.cn/img_convert/5f1166c3a2c91e910091150fe5c65565.png)
开始打包
![](https://img-blog.csdnimg.cn/img_convert/99c5b2d460548c0cc04d8ed0fbe32d5d.png)
![](https://img-blog.csdnimg.cn/img_convert/3e664f4b6068636291db15f96e31076f.png)
打包成功
![](https://img-blog.csdnimg.cn/img_convert/e1488ce7ee65686dbde4a15232e9c2a4.png)
h5打包之后,如果用的unicloud开发,可以直接上传到“前端网页托管”,然后系统会有个默认域名,我们就可以实现公网访问了
![](https://img-blog.csdnimg.cn/img_convert/9f2c34c2a8b5f59d7a0387d6e246de29.png)
h5的调试工具“vConsole”
参考: (160条消息) vue3 移动端调试工具vconsole和eruda 及其两种使用方式_vconsole包_Arrow.Light的博客-CSDN博客
![](https://img-blog.csdnimg.cn/img_convert/390d7628b6e687444b3df3c98a1b5307.png)
![](https://img-blog.csdnimg.cn/img_convert/0199dd7d1c8278da0160f19476e0c81d.png)
//附上代码
<script src="https://cdn.jsdelivr.net/npm/eruda"></script>
<script>eruda.init();</script>
app打包
详情文章可参考:
(158条消息) 【uniapp小程序】—— APP项目云打包(安卓)_uniapp打包_不苒的博客-CSDN博客
http://t.csdn.cn/cWVqY
打包前配置
![](https://img-blog.csdnimg.cn/img_convert/c757ee028a4e76a9b778eef8c01ea725.png)
打包;我用的unicloud开发,所以选的是云打包
![](https://img-blog.csdnimg.cn/img_convert/fcc19e171670162fa4432cbdae914301.png)
这表示人太多,等待下就好了
![](https://img-blog.csdnimg.cn/img_convert/ba5a15531ee1e469d445f351d683634c.png)
打包成功
![](https://img-blog.csdnimg.cn/img_convert/d2169c5d36583ea95a221f61b27f9774.png)
下载到手机 运行app
![](https://img-blog.csdnimg.cn/img_convert/b0bf4038ebc20daa1e3ff79b2d107434.png)
问题:uni-app打包安卓时,打包完只显示底部导航栏,页面内容是空白的
![](https://img-blog.csdnimg.cn/img_convert/f586c452b8f39c70c6a95a64932f30df.png)
解决:开启基座调试,查看问题
调试发现控制台报:Uncaught ReferenceError: Cannot access 'trees' before initialization
于是我就在uniapp中搜索“trees”,反正是uview中定义的UI组件,删除ui组件后,重启基座,然后就运行成功了
如何开启基座调试:
-
自定义基座
- 定义基座成功。会先创建云端证书,如下如,然后进行打包
- 如果显示未找到设备,就下载一个手机模拟器并打开,然后刷新就行了
- 基座调试,点击那个小虫子即可开启
wx打包
打包前配置
![](https://img-blog.csdnimg.cn/img_convert/a8fd946981eef918896c27472127ac39.png)
点击打包
![](https://img-blog.csdnimg.cn/img_convert/5d7a4d513646b052ef36a2cc5573b93a.png)
![](https://img-blog.csdnimg.cn/img_convert/7be49da59679262305fbc7b941c25fe3.png)
上传成功
![](https://img-blog.csdnimg.cn/img_convert/5c72c1ada8ed912cc06344f968bac963.png)
遇到的问题: http://127.0.0.1:7001 不在以下 request 合法域名列表中 || request 合法域名校验出错 || 连接本地调试服务失败,请检查客户端是否和主机在同一局域网下
解决:
首页看官方
![](https://img-blog.csdnimg.cn/img_convert/68f5b638d301aaf7eaab16de4715ace2.png)
可以得知,如果我们当时HBuild中选的是运行,然后在微信中在点击上传,那么项目第一次会默认请求本地服务,所有就会报上面的错了。请务必在HBuilderX内使用发行菜单。
ReferenceError: _t40 is not defined || ReferenceError: _s30 is not defined
将es6转为es5取消掉即可