Skip to content

A powerful componentized framework.一个强大、100% 兼容、支持 AndroidX、支持纯 Kotlin并且灵活的组件化框架

License

Notifications You must be signed in to change notification settings

xiaojinzi123/KComponent

Repository files navigation

KComponentComponent 升级而来. 全面升级为纯 Kotlin 项目

KComponent 是一个组件化框架. 它提供了两大核心:路由 和 服务发现 和其他框架这里就不比较了. 用过以前的 Component 的朋友是清楚的.

查看文档请点我

KComponent

使用

依赖配置

手动加载 反射 或者 自动加载 ASM 字节码

路由

@RouterAnno(
    hostAndPath = "user/login",
)
class LoginAct: AppCompatActivity {
  
  @AttrValueAutowiredAnno
  late init name: String
  
  @AttrValueAutowiredAnno("password")
  var password1: String? = null
  
  override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    Component.inject(target = this)
    // xxxxxx
  }
  
}
Router
.with(context)
.hostAndPath("user/login")
.putString("name", "xiaojinzi")
.putString("password", "123456")
.forword()

更多的用法和更详细的解释请查看文档:路由跳转路由标记 @RouterAnno 的使用

服务发现

interface UserSpi {
  fun login(name: String, password: String)
}

@ServiceAnno(UserSpi::class)
class UserSpiImpl : UserSpi {
  fun login(name: String, password: String) {
    // xxxx
  }
}
UserSpi::class.service()?.login(name = "xiaojinzi", password = "xxxxxx")

更多的用法和更详细的解释请查看文档:服务发现的使用服务的装饰增强

扫码进群

微信群的话, 需要先添加微信 xiaojinzi_wx 或者直接扫码. 并且备注:github 我看到了会拉你进群

8. 如果你觉得项目不错, 就请我喝杯咖啡吧! 一块钱也是爱!

9. License

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

About

A powerful componentized framework.一个强大、100% 兼容、支持 AndroidX、支持纯 Kotlin并且灵活的组件化框架

Resources

License

Stars

Watchers

Forks

Packages

No packages published