Skip to content

Wrong description of custom directive in documentation(vue 3) #1428

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

Closed
rinbowLi opened this issue Jan 12, 2022 · 1 comment
Closed

Wrong description of custom directive in documentation(vue 3) #1428

rinbowLi opened this issue Jan 12, 2022 · 1 comment

Comments

@rinbowLi
Copy link

rinbowLi commented Jan 12, 2022

image
This is the description in the documentation(vue3)
the link to the documentation

  • test code
<script>
import { ref, onMounted,onBeforeMount } from "vue";
export default {
  directives: {
    focus: {
      beforeMount() {
        console.log("custom-directive's beforeMount");
      },
      mounted(el) {
        console.log("custom-directive's mounted");
        el.focus();
      },
    },
  },
  setup() {
    const inputValue = ref("123");


    onBeforeMount(() => {
      console.log("component's onBeforeMount");
    });

    onMounted(() => {
      console.log("component's onMounted");
    });


    return () => (
      <div>
        <h2>{inputValue.value}</h2>
        <input v-model={inputValue.value} v-focus />
      </div>
    );
  },
};
</script>

image

Here is a screenshot of the printout

Obviously the mounted of the custom directive is earlier than the onMounted of the component, so the documentation describes the error

@rinbowLi rinbowLi changed the title Wrong description of custom directive in documentation Wrong description of custom directive in documentation(vue 3) Jan 12, 2022
@NataliaTepluhina
Copy link
Member

Closing the issue as related PR was merged

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

No branches or pull requests

2 participants