34 lines
668 B
Dart
34 lines
668 B
Dart
import 'package:getx_scaffold/getx_scaffold.dart';
|
|
|
|
class SiteController extends GetxController with BaseControllerMixin {
|
|
@override
|
|
String get builderId => 'site';
|
|
|
|
SiteController();
|
|
|
|
bool hasReservationData = false;
|
|
|
|
@override
|
|
void onInit() {
|
|
super.onInit();
|
|
fetchReservationData();
|
|
}
|
|
|
|
Future<void> fetchReservationData() async {
|
|
|
|
showLoading("加载中");
|
|
// 模拟网络请求延迟
|
|
await Future.delayed(const Duration(seconds: 1));
|
|
|
|
hasReservationData = !hasReservationData;
|
|
|
|
dismissLoading();
|
|
updateUi();
|
|
}
|
|
|
|
// 如果需要一个方法来清空数据
|
|
void clearData() {
|
|
hasReservationData = false;
|
|
}
|
|
}
|