You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Step 1: Create a Vue instanceconstVue=require("vue");constAppCard={template: `<div>appCardProp: {{ appCardProp }}</div>`,props: {appCardProp: {}}}constPlayerCard={template: `<AppCard v-bind="$attrs" />`,components: { AppCard },inheritAttrs: false}constapp=newVue({template: ` <div> <PlayerCard app-card-prop="appCardProp value" /> </div> `,components: { PlayerCard }});// Step 2: Create a rendererconstrenderer=require("vue-server-renderer").createRenderer();// Step 3: Render the Vue instance to HTMLrenderer.renderToString(app,(err,html)=>{if(err)throwerr;console.log(html);// <div data-server-rendered="true"><div app-card-prop="appCardProp value">appCardProp: appCardProp value</div></div>// Html attribute "app-card-prop" must be missing});
What is expected?
<divdata-server-rendered="true"><div>
appCardProp: appCardProp value
</div></div>
What is actually happening?
<divdata-server-rendered="true"><divapp-card-prop="appCardProp value">
appCardProp: appCardProp value
</div></div>
This bug happens when i use component with inheritAttrs: false, which use another component on top level of section or render function.
I want to pass props to inner component with v-bind="$attrs" and inheritAttrs: false. It passes props inside but still adds attributes to html element.
I noticed that this bug doesn't occur in next cases:
if i set inheritAttrs: false on inner component (AppCard of code section).
if top level of "template" or render function is not a component (e.g. simple "div" or "span").
Version
2.6.11
Reproduction link
https://github.com/Tibon4ik/vue-server-renderer-inherit-attrs
Steps to reproduce
Clone the repo
Or:
What is expected?
What is actually happening?
This bug happens when i use component with inheritAttrs: false, which use another component on top level of section or render function.
I want to pass props to inner component with v-bind="$attrs" and inheritAttrs: false. It passes props inside but still adds attributes to html element.
I noticed that this bug doesn't occur in next cases:
Related: nuxt/nuxt#7195
The text was updated successfully, but these errors were encountered: