vue-easytable icon indicating copy to clipboard operation
vue-easytable copied to clipboard

[Bug Report] Since 2.12 SSR is broken

Open nekdolan opened this issue 2 years ago • 4 comments

选择要提交 issue 的库

vue-easytable

Issue 类型

Bug

Issue 标题

Since 2.12 SSR is broken

仓库版本

2.12.0

Vue 版本

2.6.14

浏览器

Firefox

系统类型

Linux

重现链接

render with Nuxt SSR

重现步骤

Because there are no globals (document) in SSR mode vue-easytable can no longer be rendered on server side (I am therefore stuck with version 2.11.0 that still works)

期望的结果是什么?

The page should render in SSR

实际的结果是什么?

Fatal error during render

nekdolan avatar Jan 07 '22 17:01 nekdolan

Sorry, I'm not familiar with Nuxt. I need to take some time to this problem

huangshuwei avatar Jan 08 '22 02:01 huangshuwei

I've made a sandbox with nuxt: https://codesandbox.io/s/nuxt-playground-forked-h4lx0

ERROR  [Vue warn]: Error in render: "ReferenceError: document is not defined"

found in

---> <VeTable>
       <Pages/index.vue> at pages/index.vue
         <Nuxt>
           <Default> at layouts/default.vue

Basically browser globals such as window or document should not be used during the initial render as those globals are missing on the server.

See: https://nuxtjs.org/docs/concepts/server-side-rendering/#server-vs-browser-environments

nekdolan avatar Jan 11 '22 15:01 nekdolan

Thank you for your feedback. It's useful for positioning problems.

huangshuwei avatar Jan 12 '22 01:01 huangshuwei

nuxt.config.jsplugins 可以写成这样: plugins: [{ src: "~/plugins/ve-table", ssr: false }] 或者 plugins: [{ src: "~/plugins/ve-table", mode: 'client' }]

Aruelius avatar May 06 '22 07:05 Aruelius