Skip to content

Missing required prop: "resource" #1

Open
@bitsnaps

Description

Hi,

I get a weird warning about resource props, I thought because optional props are not required in this example since we've provided a default value and we're using the NotFound component in the path: /:catchAll(.*), so I set required to false in order to get rid of this warning:

main.js?t=1699883629605:10
[Vue warn]: Missing required prop: "resource" 
  at <NotFound onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< undefined > > 
  at <RouterView> 
  at <App>

Here is the change I made:

import { defineProps } from "vue";

defineProps({
  resource: {
    type: String,
    required: false, // <-- This has to be false?
    default: "page",
  },
});

Here are my versions:

  "dependencies": {
    "axios": "^1.6.1",
    "pinia": "^2.1.7",
    "vue": "^3.3.8",
    "vue-router": "^4.2.5"
  },
  "devDependencies": {
    "@vitejs/plugin-vue": "^4.4.1",
    "vite": "^4.5.0"
  }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions