dream-num / univer

Univer is an open-source productivity tool dev kit helping you integrate spreadsheets, docs and slides into your applications.
https://univer.ai
Apache License 2.0
6.89k stars 597 forks source link

[Bug] Version 4.1 cannot be used in vue3 template #3831

Closed suqiufang closed 1 hour ago

suqiufang commented 3 hours ago

Before you submit this issue, have you checked the following

Affected packages and versions

4.1

Reproduction link

https://github.com/awesome-univer/sheets-vite-demo/tree/c47814f1e2f3ef69acab85a7ffaf47cca0e16e24

Expected behavior

4.1版本在vue3项目中使用,希望可以挂载到非根节点上

Actual behavior

4.1版本在vue3项目中使用,只能挂载到根节点上渲染,导致无法渲染其他内容

System information

No response

univer-bot[bot] commented 3 hours ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿

Origin Title: [Bug] 4.1版本无法在vue3模版中使用

Title: [Bug] Version 4.1 cannot be used in vue3 template


Before you submit this issue, have you checked the following

Affected packages and versions

4.1

Reproduction link

https://github.com/awesome-univer/sheets-vite-demo/tree/c47814f1e2f3ef69acab85a7ffaf47cca0e16e24

Expected behavior

Version 4.1 is used in the vue3 project, and it is hoped that it can be mounted on non-root nodes.

Actual behavior

Version 4.1 is used in the vue3 project and can only be mounted to the root node for rendering, resulting in the inability to render other content.

System information

No response

hexf00 commented 1 hour ago

Our Vue3 example works fine, perhaps you can refer to it. https://univer.ai/playground?title=Vue+3

hexf00 commented 1 hour ago

I have reviewed your code, and the way you're using Vue and Univer is incorrect. You should initialize Univer after the DOM is ready. Please ensure your code has the following structure:

import { onMounted } from "vue";

onMounted(() => {
    // Initialize Univer
})