---
category: agent
title: LoaidngController
subtitle: 加载状态区
name: 'nova-waiting-loading'
label: waiting
---


# 使用示例
```
import { TipsController,FmodeLoadingController,FmodeLoadingInstance } from 'fmode-ng/lib/core/agent'; 

const loader = new FmodeLoadingInstance({
  message: "初始化任务",
  progress: 0.2,
  taskIndex: 1,
  taskTotal: 5
});

loader.present();

setTimeout(() => {
  loader.message = "正在处理下一步...";
  loader.taskIndex = 2;
  loader.progress = 0.5;
}, 2000);

setTimeout(() => {
  loader.message = "任务完成";
  loader.taskIndex = 5;
  loader.progress = 1;
}, 4000);

```

```
// 用法示例
const loadingCtrl = new FmodeLoadingController();

// 在组件或逻辑中
(async () => {
  const loading = await loadingCtrl.create({
    message: "任务加载中...",
    progress: 0,
    taskIndex: 1,
    taskTotal: 5,
    position: "middle",
  });

  await loading.present();

  // 示例：3秒后修改状态
  setTimeout(() => {
    loading.message = "任务2加载中...";
    loading.taskIndex = 2;
    loading.updateUI();
  }, 3000);

  // 10秒后销毁
  setTimeout(() => {
    loading.dismiss();
  }, 10000);
})();
```

