赞
踩
VueKotlin 是轻量级IOC(控制反转),MVVM,面向接口编程动态组件框架,快捷方便,不侵入兼容老项目。
地址:wangyongyue/VueKotlinDemo地址:
wangyongyue/VueKotlinDemo
github.com图标
实例:
Router.push(TextModel()) //使用
//消息ID
val arrayID = “arrayID”
val indexID = “indexID”
class Main2Activity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) addActivity() var v = vue recyler.layoutManager = LinearLayoutManager(this) var ad = RAdapter() ad.v_array(arrayID,v) recyler.adapter = ad ad.v_index(indexID,v) v.v_start() } override fun onDestroy() { super.onDestroy() removeActivity() }
}
class TextModel: Vue() {
override fun v_viewController(): Class<Any>? { return Main2Activity::class.java as Class<Any> } override fun v_start() { super.v_start() var items = mutableListOf<VueData>() for (i in 1..12){ items.add(UserData("text$i")) } this.v_array(arrayID,{ return@v_array items }) this.v_index(indexID,{ it:Int -> }) }
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。