• 首页
  • 产品中心
    • 数式Oinone四大产品

      低代码开发平台无代码开发平台集成开发平台AI大模型开发
    • 数式Oinone体系能力

      用户与组织权限管理文件管理消息中心国际化业务审计
    • 数式Oinone核心产品特性

      低无一体面向软件公司场景无限制应用级扩容可分可合
  • 服务中心
    • 客户服务

      预约演示方案咨询私有部署找人定制
    • 开发者

      问答下载
    • Oinone学院

      社区学习

    《精讲面向软件公司的低代码平台——以Oinone为例》

  • 合作伙伴
    渠道申请伙伴名录专家库
  • 关于数式
0571-88757863

Field:How to Automatically Refresh Views When Switching Between Multi-Tabs


I. Scenario Overview

In daily project development, the application scenario of multi-view tabs is quite common. In such scenarios, when users switch between different views, it is often necessary to refresh the view data or status within the currently active tab. This article will conduct a detailed analysis of the following code and explain how to precisely refresh the corresponding view during view switching with the help of this code. It should be particularly noted that the following code is located in the main.ts file of the ss - boot project.

import { VueOioProvider } from '@oinone/kunlun-dependencies';
import { delay } from 'lodash-es';

VueOioProvider(
  {
    ... self-configuration
  },
  [
    () => {
      setTimeout(() => {
        subscribeRoute(
          (route) => {
            const page = route.segmentParams.page || {};

            // If it is not a table type, do not refresh (judge according to your own needs)
            if (page.viewType !== ViewType.Table) {
              return;
            }

            const { model, action } = page;

            const multiTabsManager = MultiTabsManager.INSTANCE;

            delay(() => {
              const tab = multiTabsManager.getActiveTab();

              if (tab?.key && tab.stack.some((s) => s.parameters?.model === model && s.parameters?.action === action)) {
                multiTabsManager.refresh(tab.key);
              }
            }, 200);
          },
          { distinct: true }
        );
      }, 1000);
    }
  ]
);

II. VueOioProvider and Its Role

First, the code initializes the application or component through VueOioProvider and passes in two parts of parameters:

  • Configuration object: It can be customized according to actual business needs;
  • Callback function array: Here, an anonymous function is passed in to execute additional logic after the application is initialized.

III. Delayed Execution and Route Listening

In the callback function, setTimeout is used to delay execution by 1000 milliseconds. The purpose is usually to ensure that other components or global states have been initialized before starting route listening.

Subsequently, the code calls subscribeRoute to listen for changes in the route. subscribeRoute accepts two parameters:

  • Callback function: This function will be triggered every time the route changes, and the latest route object will be passed to it;
  • Configuration object: Here, { distinct: true } is used to avoid repeated triggers and improve performance.

IV. Judging View Type

Inside the route callback function, the configuration information of the current page is first obtained through route.segmentParams.page. By judging whether page.viewType is equal to ViewType.Table, the code can determine whether the current view is of the "table type":

  • If it is not a table type: directly return without performing a refresh operation;
  • If it is a table type: continue to execute the subsequent refresh logic.

This judgment mechanism ensures that only specific types of views (such as tables) will trigger a refresh when switched, avoiding unnecessary operations.

V. Refresh Logic for Multi-View Tabs

After confirming that the current view type is a table, the currently active tab needs to be obtained from MultiTabsManager. The specific operation is to call the MultiTabsManager.INSTANCE.getActiveTab() method, which will return the current active tab object. Subsequently, a conditional judgment is made. If the key exists and the action stored inside the activated tab is consistent with the url, the multiTabsManager.refresh(key) method is called at this time to achieve the refresh operation of the view within the current tab.

Edit this page
Last Updated:1/15/26, 4:02 AM
Prev
Release:Frontend Release Process
Next
Field:Data Pop-Back from Popup Operations to Fields
默认页脚
Copyright © 2026 Mr.Hope