当前位置:   article > 正文

VueKotlin 2.0发布了_kotlin写vue

kotlin写vue

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()
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20

}
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 ->


    })


}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22

}

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/木道寻08/article/detail/747525
推荐阅读
  

闽ICP备14008679号