SelfZhangTQ / T-MVVM

This repository contains a detailed sample app that implements MVVM architecture using LiveData,ViewModel,Retrofit,Rxjava
685 stars 163 forks source link

数据源LiveData不在ViewModel里? #20

Open ukyo6 opened 5 years ago

ukyo6 commented 5 years ago

如果数据源的LiveData不在ViewModel里, 那么configChange以后, Activity重建后, 也无法从ViewModel里获取到数据, 还要重新请求. 直接通过ViewModel来调用Repository通过LiveDataBus发送数据感觉和MVP的思想是一样的. ViewModel里并没有保存数据啊

JitMaos commented 3 years ago

如果数据源的LiveData不在ViewModel里, 那么configChange以后, Activity重建后, 也无法从ViewModel里获取到数据, 还要重新请求. 直接通过ViewModel来调用Repository通过LiveDataBus发送数据感觉和MVP的思想是一样的. ViewModel里并没有保存数据啊

+1