请选择 进入手机版 | 继续访问电脑版
 找回密码
 立即注册

QQ登录

只需一步,快速开始

qwedcxzas

金牌服务用户

47

主题

162

帖子

493

积分

金牌服务用户

积分
493

[已处理] spreadJS初始化

qwedcxzas
金牌服务用户   /  发表于:2023-2-27 18:31  /   查看:1111  /  回复:7
spreadJS初始化的时候,@designerInitialized="designerInitialized" 这个方法的执行顺序在 后端返回数据的方法之前

7 个回复

倒序浏览
Ellia.DuanSpreadJS 开发认证
超级版主   /  发表于:2023-2-28 09:07:35
沙发
您好,您可以在designerInitialized方法中调用后端数据。
回复 使用道具 举报
qwedcxzas
金牌服务用户   /  发表于:2023-2-28 13:55:48
板凳
我怎么上传文件呢
回复 使用道具 举报
qwedcxzas
金牌服务用户   /  发表于:2023-2-28 14:00:54
地板
本帖最后由 qwedcxzas 于 2023-2-28 14:02 编辑

  1. <template>
  2.   <div>
  3.    
  4.       <gc-spread-sheets-designer :styleInfo="styleInfo" @designerInitialized = "designerInitialized">
  5.       </gc-spread-sheets-designer>
  6.    
  7.     <gc-spread-sheets-designer id="ss" :styleInfo='styleInfo'
  8.                                :config='config'
  9.                                @designerInitialized="designerInitialized">
  10.     </gc-spread-sheets-designer>
  11.   </div>
  12. </template>

  13. <script>



  14. import * as GC from "@grapecity/spread-sheets";
  15. GC.Spread.Common.CultureManager.culture("zh-cn");

  16. import "@grapecity/spread-sheets-tablesheet";
  17. import "@grapecity/spread-sheets-barcode";
  18. import "@grapecity/spread-sheets-charts";
  19. import "@grapecity/spread-sheets-shapes";
  20. import "@grapecity/spread-sheets-languagepackages";
  21. import "@grapecity/spread-sheets-print";
  22. import "@grapecity/spread-sheets-pdf";
  23. import "@grapecity/spread-sheets-pivot-addon";
  24. import "@grapecity/spread-sheets-resources-zh";
  25. import "@grapecity/spread-sheets-designer-resources-cn";
  26. import "@grapecity/spread-sheets-designer"  /** as GCDesigner from*/
  27. import * as ExcelIO from "@grapecity/spread-excelio"
  28. import "@grapecity/spread-sheets/styles/gc.spread.sheets.excel2013white.css";
  29. import "@grapecity/spread-sheets-designer/styles/gc.spread.sheets.designer.min.css";


  30. import '@grapecity/spread-sheets/styles/gc.spread.sheets.excel2013white.css'
  31. import '@grapecity/spread-sheets-designer/styles/gc.spread.sheets.designer.min.css'
  32. //import '@grapecity/spread-sheets-designer-resources-en'
  33. import '@grapecity/spread-sheets-designer-vue'
  34. import axios from "axios";

  35. export default {
  36.   data: function() {
  37.     return {
  38.       spread: null,
  39.       styleInfo1: {height: window.innerHeight-65+'px'},
  40.       styleInfo: { height: '500px', width: '1200px', border: 'solid black 1px' },
  41.       config: null,
  42.       designer: null,
  43.       json:''
  44.     };
  45.   },
  46.   mounted() {

  47.   },
  48.   destroy(){
  49.     //this.spread.destroy();
  50.   },
  51.   beforeDestroy(){
  52.     this.spread.destroy();
  53.   },
  54.   created() {
  55.     this.getSpread()
  56.   },
  57.   methods: {
  58.     getSpread(){
  59.       axios.post('/getSpread').then(res=>{ //后端获取数据
  60.         this.json=res.data
  61.         const jsonOptions = {
  62.           incrementalLoading: true, // use the incremental loading when converting json to workbook, default value is false
  63.         };
  64.         this.spread.fromJSON(res.data,jsonOptions);
  65.       })
  66.     },
  67.     designerInitialized: function(designer) {
  68.       let spread =  designer.getWorkbook()
  69.       this.spread=spread
  70.     },
  71.   },

  72. };

  73. </script>


复制代码
回复 使用道具 举报
qwedcxzas
金牌服务用户   /  发表于:2023-2-28 14:02:53
5#
模板文件  我发不过去啊,不知道怎么上传压缩包
回复 使用道具 举报
何时待我
高级会员   /  发表于:2023-2-28 14:30:51
6#
qwedcxzas 发表于 2023-2-28 14:02
模板文件  我发不过去啊,不知道怎么上传压缩包

image.png75742186.png
回复 使用道具 举报
Ellia.DuanSpreadJS 开发认证
超级版主   /  发表于:2023-2-28 14:31:49
7#
我的意思是您可以在加载designer组件,就获取json文件,或者在designerInitialized方法中调用this.getSpread()
回复 使用道具 举报
Ellia.DuanSpreadJS 开发认证
超级版主   /  发表于:2023-2-28 17:25:56
14#
qwedcxzas 发表于 2023-2-28 14:42
这样也可以,现在的问题就是  浏览器  OOM 了

关注到您关于此问题,也发了一个帖子,所以本贴就关闭,将移至https://gcdn.grapecity.com.cn/fo ... read&tid=161965
此贴中进行处理内存溢出问题。
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部