I am facing issue in vue.js about "Uncaught TypeError: Right-hand side of 'instanceof' is not an object".
I am using Vue 2.2.1 version following is my code snippet where I am getting this issue.
Vue.component('componentName', {
'template': ``,
props: {
contentTypeUid: {
type: 'string',
required: false
},
limit: {
type: 'number',
required: false,
default: 10
}
},
......
});
While if instead of above following working without any issue, but I want to use above format as I need to specify some validations and default values on props.
Vue.component('componentName', {
'template': ``,
props: ["contentTypeUid", "limit"],
......
});
Thanks.
Types of errors js app: Syntax errors occur when you use the wrong syntax. Runtime errors are caused by illegal operations during execution. Logical errors are difficult to identify because they result from mistakes in the program logic. HTTP errors are common when you're working with APIs.
The $el option in Vue provides Vue with an existing HTML element to mount the Vue instance generated using the new keyword. this. $el. querySelector is used to access HTML elements and modify the element's properties.
Vuex is a state management pattern for vue. js. $t is the injected method from vue. js or Vue. i18n.
$v is an object that calls vuelidate (at the time of writing the comment, supported in version Vue. js 2.0), which is intended to check every input, which is made in a non-html form.
Use:
props: {
contentTypeUid: {
type: String, // not 'string'
required: false
},
limit: {
type: Number, // not 'number'
required: false,
default: 10
}
},
In my case, it was a component property that had a null type:
props: {
role:{
type: [String, null],
required: true
},
changing it to
props: {
role:{
type: String,
required: true
},
And making sure, that the component always gets a string, fixed the issue. I guess the combination of required and a possible null value was not very good...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With