fuxingloh / vue-horizontal

An ultra simple pure vue horizontal layout for modern responsive web with zero dependencies. (SPA/SSG/SSR)
https://vue-horizontal.fuxing.dev
MIT License
228 stars 32 forks source link

'container' in $refs is undefined #105

Open Sqweedward opened 3 years ago

Sqweedward commented 3 years ago

package v0.8.10 .

Exception: TypeError: Cannot read property 'children' of undefined

at VueComponent.children (vue-horizontal.esm.js?f67a:86)
at VueComponent.calculate (vue-horizontal.esm.js?f67a:232)
at VueComponent.eval (vue-horizontal.esm.js?f67a:220)
at Array.eval (vue.runtime.esm.js?ff9b:1980)
at flushCallbacks (vue.runtime.esm.js?ff9b:1906)
tibs245 commented 11 months ago

Hi, I have the same issue with SSR.

When I use <client-only></client-only> this resolve the error but I want use SSR.

It's possible to add in src/vue-horizontal.vue a '?' for prevent this error ?

    children(): HTMLCollection {
      const container = this.$refs.container as Element
      return container?.children ?? []
    },