apitable icon indicating copy to clipboard operation
apitable copied to clipboard

question: 关于小程序展示表格的技术方案咨询

Open TheChildWang opened this issue 1 year ago • 1 comments

首先,十分感谢维格云可以开源这么优秀的产品 ~

背景: 在仪表盘中不只要展示图表,有时也要展示明细数据,并提供进一步操作,所以我想咨询如何在小程序中安全渲染表格。

社区有一个网址预览的小程序,原理是用 iframe 加载网址,可以在仪表盘展示表格数据,不过存在一些体验层面的缺点:

  首先、打开性能较慢,资源要重新加载;
  第二,使用展开行、插入行、筛选等功能受限于iframe的大小,操作很不方便。

所以我尝试了另一种方案,在小程序中直接渲染 DatasheetPane 组件(使用这里提到的方式),不过后期也遇到了问题,虽然小程序和主程序的Redux Store 存在隔离,不过 @apitable/core 中有很多地方使用了全局变量的方式访问 Store

/**
 * Static store for injection to external callers (web-side).
 * Before calling Field on the web side, inject the store instance first, then you don't need to pass in the store again every time you bindModel
 */
let storeCache: Store;
export const injectStore = (store: Store) => { storeCache = store; };

这就导致在仪表盘中渲染两个表格的时候,数据会相关干扰。

我的问题是,是否有其他技术方案可以实现Redux Store 安全隔离?或者有更好的方案实现我的需求。

感谢可以提供一些建议或思路 。

TheChildWang avatar Apr 19 '24 15:04 TheChildWang

目前架构中 store 中包括多个datapack, 这是因为关联表和关联数据, 如果渲染两个表格数据有误,建议从业务逻辑本身处理。

ranglang avatar May 09 '24 08:05 ranglang