Answer the question
In order to leave comments, you need to log in
How to use standard javascript functions in vue?
Such a question arose when it was required to execute indexOf()
And he did not want to be executed with the error
Cannot read property 'indexOf' of undefined
at VueComponent
As in methods
videoShow(url){
if(url.indexOf('.mp4') != -1){
return true
}else{
return false
}
}
v-if="url.indexOf('.mp4') !== -1"
Answer the question
In order to leave comments, you need to log in
Cannot read property 'indexOf' of undefined
It's not about vue, it's about the fact that you didn't pass the url to the method (or it's just undefined)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question