UniAppX 常见问题汇总
- Android开发环境怎么配置?
ts
1. 打开Hbx设置 -> 插件配置 -> uts开发扩展
2. 先安装gradle7.5以上 - 8.0以下版本(https://gradle.org/releases/)
3. 后安装AndriodStudio开发软件(https://developer.android.google.cn/studio)
4. 中间JDK无需安装1. 打开Hbx设置 -> 插件配置 -> uts开发扩展
2. 先安装gradle7.5以上 - 8.0以下版本(https://gradle.org/releases/)
3. 后安装AndriodStudio开发软件(https://developer.android.google.cn/studio)
4. 中间JDK无需安装- Android运行编译时报:java.lang.0utOfMemoryError:Java heap space等类似错误,怎么解决?
ts
1. 打开Hbx设置 -> 运行配置 -> uni-app x运行配置
2. 把kotlin编译器最大堆内存大小改成1024,如果不行就递增,直到能运行为止1. 打开Hbx设置 -> 运行配置 -> uni-app x运行配置
2. 把kotlin编译器最大堆内存大小改成1024,如果不行就递增,直到能运行为止- iOS运行编译时报:FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory等类似错误,怎么解决?
ts
1. 打开Hbx设置 -> 运行配置 -> uni-app运行配置
2. 把node启动内存参数改成1024,如果不行就递增,直到能运行为止1. 打开Hbx设置 -> 运行配置 -> uni-app运行配置
2. 把node启动内存参数改成1024,如果不行就递增,直到能运行为止- APP运行时报各种原生插件无法解析、类型未定义,怎么解决?
ts
请制作自定义基座后运行请制作自定义基座后运行- uniappx 状态管理有什么解决方案?
ts
请查看官方解决方案 (https://doc.dcloud.net.cn/uni-app-x/tutorial/store.html)请查看官方解决方案 (https://doc.dcloud.net.cn/uni-app-x/tutorial/store.html)- 组合式怎么获取选项式中的this?
ts
const this = getCurrentInstance()?.proxyconst this = getCurrentInstance()?.proxy- uni.request为什么二次封装后,使用泛型编译失败?
ts
请参考官方教程使用 (https://doc.dcloud.net.cn/uni-app-x/api/request.html#%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9)请参考官方教程使用 (https://doc.dcloud.net.cn/uni-app-x/api/request.html#%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9)- 如何获取组件ref,并调用内部函数?
ts
固定写法:组件名驼峰+ComponentPublicInstance
<ux-button ref="buttonRef"></ux-button>
选项式示例:
const buttonRef = this.$refs["buttonRef"] as UxButtonComponentPublicInstance
buttinRef.$callMethod('函数名', '参数')
组合式示例:
const buttonRef = ref<UxButtonComponentPublicInstance | null>(null)
buttinRef?.$callMethod('函数名', '参数')固定写法:组件名驼峰+ComponentPublicInstance
<ux-button ref="buttonRef"></ux-button>
选项式示例:
const buttonRef = this.$refs["buttonRef"] as UxButtonComponentPublicInstance
buttinRef.$callMethod('函数名', '参数')
组合式示例:
const buttonRef = ref<UxButtonComponentPublicInstance | null>(null)
buttinRef?.$callMethod('函数名', '参数')- 当同一个页面引入2种不同的字体图标库,为什么其中一个不显示?
ts
请检查2种不同的字体库的family是否唯一请检查2种不同的字体库的family是否唯一