Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

非初始化的導入多 sheet 後,切換 sheet 會出現 this.data is undefined 的問題 #701

Open
mukiwu opened this issue Jun 27, 2024 · 1 comment

Comments

@mukiwu
Copy link

mukiwu commented Jun 27, 2024

初始化使用 loadData() 可以正常切換多個 sheet,但我想要做導入 Excel 的功能,所以點了按鈕之後才使用 loadData()

init = () => {
  spreadsheet.value = new Spreadsheet(spreadsheetContainer.value as HTMLDivElement, {
    showToolbar: true,
    showGrid: true,
    view: {
      width: () => props.mainWidth,
      height: () => props.mainHeight
    },
    row: {
      len: 500,
      height: 25
    }
  })
}

onClick = () => {
  spreadsheet.value.loadData(workbook.value)
}

結果要切換不同工作表時,就出現錯誤

Cannot destructure property 'rows' of 'this.data' as it is undefined.

目前看起來是沒有取到 this.data,導致後續問題
截圖 2024-06-27 18 02 24

有人碰過類似的問題嗎?

目前想到比較爛的解法是先銷毀再創建實例,但我也沒找到銷毀的方法 ....

@zht1124
Copy link

zht1124 commented Sep 3, 2024

我也遇到了这个问题,请问最后解决了吗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants