Subscribe on changes!

`$attrs` is nested

avatar
Jul 13th 2021

Version

3.1.4

Reproduction link

https://codesandbox.io/s/elegant-merkle-2t2rb?file=/src/App.vue

Steps to reproduce

  • Open the code sandbox link

What is expected?

test: { "hello": "world" } was supposed to be rendered.

What is actually happening?

test: { "attrs": { "hello": "world" } } is rendered. $attrs include a key attrs.


render(h) {
    return h(Test, {
      attrs: {
        hello: "world",
      },
    });
  },

With the code above, I'm expecting the child component Test would have correct $attrs, but Vue 2 and Vue 3 behave differently.

In Vue 3, the actual data is wrapped with a key attrs.

Is it an intentional breaking change that isn't documented (or I couldn't find)? Or is it a bug?

avatar
Jul 13th 2021

It's

import { h } from "vue";
import Test from "./Test.vue";

export default {
  name: "App",
  render() {
    return h(Test, {
        hello: "world",
    });
  },
};