更新记录
1.0.0(2024-01-23)
平台兼容性
App |
快应用 |
微信小程序 |
支付宝小程序 |
百度小程序 |
字节小程序 |
QQ小程序 |
HBuilderX 3.7.0,Android:5.0,iOS:不支持,HarmonyNext:不确定 |
× |
× |
× |
× |
× |
× |
钉钉小程序 |
快手小程序 |
飞书小程序 |
京东小程序 |
× |
× |
× |
× |
H5-Safari |
Android Browser |
微信浏览器(Android) |
QQ浏览器(Android) |
Chrome |
IE |
Edge |
Firefox |
PC-Safari |
× |
× |
× |
× |
× |
× |
× |
× |
× |
sn-uts-compose
uts加载jetpack compose
使用步骤
- 基于插件中unix_compose-release.aar开发UniXComposeView
gradle配置
android {
buildFeatures {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.4.2"
}
}
代码示例
package com.itfenbao.compose
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.ComposeView
import com.itfenbao.unix.compose.IUniXComposeView
@Composable
fun MessageCard() {
Column(
Modifier.fillMaxWidth()
) {
Text(text = "Hello==")
Text(text = "compose")
Text(text = "compose==")
}
}
class BasicView : IUniXComposeView {
override fun loadComposeUI(view: ComposeView) {
view.setContent {
MessageCard()
}
}
override fun updateData(value: Map<Any, Any>) {
}
var onEvent: ((String) -> Unit)? = null
}
- 将上面代码打包成jar或者aar,丢到项目中(具体操作可以查看官网)
- 使用sn-uts-compose
<sn-uts-compose
viewClass="com.itfenbao.compose.BasicView"
style="width: 300rpx; height: 300rpx; background-color: red" />