Asked By: Anonymous
I am creating my first SPA using Vue.js, Babel and WebPack. A Vue component has the following script:
<script>
export default {
props: {
name: String,
required: true
}
}
</script>
When I run eslint I get the following warnings and error:
8:5 warning Prop 'name' requires default value to be set vue/require-default-prop
9:5 warning Prop 'required' requires default value to be set vue/require-default-prop
9:15 error The "required" property should be a constructor vue/require-prop-type-constructor
I have copied the code from a tutorial I am following and I cannot understand how to fix it?
Solution
Answered By: Anonymous
name should be an object,
<script>
export default {
props: {
name: {
type: String,
required: true
}
}
}
</script>