Unresolved reference: viewmodel compose 省略viewModel

Posted 安果移不动

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Unresolved reference: viewmodel compose 省略viewModel相关的知识,希望对你有一定的参考价值。

添加依赖

    def lifecycle_version = "2.5.1"

    implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
    implementation "androidx.lifecycle:lifecycle-viewmodel-compose:$lifecycle_version"

偷懒后

@Composable
fun MainScreen(mainViewModel: MainViewModel = viewmodel()) 

 

以上是关于Unresolved reference: viewmodel compose 省略viewModel的主要内容,如果未能解决你的问题,请参考以下文章

Kotlin的编译提示:Unresolved reference: xxx

解决pycharm无法导入本地包的问题(Unresolved reference 'tutorial')

Unresolved reference: viewmodel compose 省略viewModel

pycharm解决Unresolved Reference

解决Pycharm无法导入包问题 Unresolved reference

pycharm Unresolved reference 无法引入包