Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

attrs update not correctly mapped to props #833

Closed
muuyao opened this issue Oct 15, 2021 · 4 comments · Fixed by #835
Closed

attrs update not correctly mapped to props #833

muuyao opened this issue Oct 15, 2021 · 4 comments · Fixed by #835

Comments

@muuyao
Copy link

muuyao commented Oct 15, 2021

https://codesandbox.io/s/wizardly-hermann-kumgx?file=/src/App.js

import { defineComponent, ref, h } from "@vue/composition-api";

const Field = defineComponent({
  props: ["firstName", "lastName"],
  setup(props, { attrs }) {
    return () => {
      return h("div", [props.firstName, props.lastName]);
    };
  }
});

const WrapperField = defineComponent({
  setup(props, { attrs }) {
    return () => {
      return h(Field, {
        attrs: {
          ...attrs
        }
      });
    };
  }
});

export default defineComponent({
  setup(props, { attrs }) {
    let person = ref({
      firstName: "wang"
    });
    setTimeout(() => {
      person.value = {
        firstName: "wang",
        lastName: "xiao"
      };
    }, 1000);
    return () => {
      return h("div", [
        h(WrapperField, {
          attrs: {
            ...person.value
          }
        })
      ]);
    };
  }
});
@fakeeffect
Copy link

@edwardnyc I also encountered this problem. Have you solved it?

@antfu Is the plan feasible? Can I refer to 835 to create a new local package to solve this problem?

@edwardnyc
Copy link
Contributor

@edwardnyc I also encountered this problem. Have you solved it?

@antfu Is the plan feasible? Can I refer to 835 to create a new local package to solve this problem?

Please wait for review

@muuyao
Copy link
Author

muuyao commented Oct 25, 2021

any update?

@fakeeffect
Copy link

I'm sorry to bother you. Is this a bug? Can you add a tag in your spare time? It will affect our project use, thank you!
@antfu @ygj6

antfu pushed a commit that referenced this issue Oct 28, 2021
Co-authored-by: neiyichao03 <nieyichao03@kuaishou.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants