Default values for Vue component props & how to check if a user did not set the prop?

Default values for Vue component props & how to check if a user did not set the prop?

Asked on November 13, 2018 in vue.js.
Add Comment


  • 1 Answer(s)
    • This is an old question, but regarding the second part of the question.
    • Inspecting this within the component, we have this.$options.propsData.
    • The user has explicitly set it; default values aren’t shown.
    • This is useful in cases where you can’t really compare your value to its default, e.g. if the prop is a function.
    Answered on November 13, 2018.
    Add Comment


  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.