The problem of error reporting in props check of vue

< div id= "app" >

    <child :content="12"></child>
    <child :text="424241"></child>
</div>
<script>
    Vue.component("child",{
        template:`<div>{{content}}{{text}}</div>`,
        props:{
            content:[Number,String],
            text:{
                type:Number,
                required:false,
                default:"helloworld",
                validator(value){
                    return value.length > 5
                }
            }
        }
    })
    var vm=new Vue({
        el:"-sharpapp",

    })
</script>

Screenshot of error report:

clipboard.png

my personal understanding: text="424241", isn"t the way passed in here like a static number?
official API: ide/components-props.html-sharp%E4%BC%A0%E5%85%A5%E4%B8%80%E4%B8%AA%E6%95%B0%E5%AD%97" rel=" nofollow noreferrer "> https://cn.vuejs.org/v2/guide.
, however, the first reason for reporting an error is that this is a string
. The second reason for reporting an error is also rather confusing. Doesn"t the "424241" length meet the requirements of the validator validator? Why did you report it wrong?
I hope the boss can help me with the answer. Thank you

.
Apr.11,2021

here is a correct example, JSFiddle

first of all, if this is a Number type, then Default needs to be assigned a Number instead of String .

another potential error is the use of value.length . The Number object does not have a length attribute, so you can transfer the string and call the method

.
Menu