[Vuejs]-What causes Vue props to equal [object Object] in the DOM?

3👍

This is most likely because you haven’t defined it as a prop on the relevant component. If it isn’t defined as a prop then it’ll just be converted to a string and added as an attribute to the outermost element of the component.

If your component does define this prop then check its template to see whether it is adding this attribute to its outermost element itself. If it’s calling out to some other component at the root of the template then you’ll similarly need to check whether that component defines this prop.

1👍

The dom will register the prop as [object Object] if the component hasn’t been registered properly, ie

import ExampleComponent from '...'
export default {
    components: { ExampleComponent },
}

Leave a comment