dalphyx / vue-headroom

Headroom for Vuejs
128 stars 16 forks source link

Runtime-only build error when using server-side rendering #2

Closed jpt closed 7 years ago

jpt commented 7 years ago

Tried using vue-headroom and got the following error:

[Vue warn]: You are using the runtime-only build of Vue where the template option is not available. Either pre-compile the templates into render functions, or use the compiler-included build. (found in component )

jpt commented 7 years ago

@dalphyx Any thoughts on resolving this?

dalphyx commented 7 years ago

@jpt OK, I will try to resolve this problem later. Personally, I have not used vue-headroom in SSR before, but I meet the same warn in other cases. Maybe you should import the compiler-included build Vue in server side.

jpt commented 7 years ago

@dalphyx Sounds good, I'll try importing the build with the compiler. It could be unrelated to SSR.

To get rid of the warning, might need to replace the template: with render:

Like this:

render: h => {
    return ('\n    <div class="headroom-wrapper" :style="wrapperStyles">\n      <div class="headroom" :style="innerStyle">\n        <slot></slot>\n      </div>\n    </div>\n  ')
},

But that may cause other problems...

dalphyx commented 7 years ago

@jpt I have transpiled template to render function and pass test in nuxt. You can try the latest version :)

jpt commented 7 years ago

@dalphyx that seems to have fixed it! Thanks so much for the quick response! 😄