The computational attributes in vue are determined by the data that is requested to be returned.

<template>
    <div
       v-if="type == xxx"        
        ></div>
       //type
</template>


computed:{
    type(){
        return (ajax)
    }
}
Oct.23,2021

computed is calculated on the basis of existing data and cannot be calculated in this way


you can first define a variable in data, then give a default value, and the ajax method requests to come back and write back the variable you set before; then calculate the attribute type and then according to the variable you defined.

<template>

<div
   v-if="type == xxx"        
    ></div>
   //type
</template>
data(){
    return {
        type1: '',(ajax)
    }
},
computed:{

type(){
    return this.type1
}
}
Menu