In vue.js, axios goes to the background to get data (asynchronously), but the page begins to render {{info.name}}.

    <div id="student-info" class="header-info clear-both">
        <div class="header-box clear-both">
            <!--  -->
            <a class="img_href" href="-sharp">
                <img class="my-head" v-bind:src="imgUrl" />
            </a>
            <!--  -->
            <div class="my-info clear-both">
                <div class="top-info clear-both">
                    <span class="nickname" v-if="name">{{name}}</span>
                    <span id="student_age" class="age">{{age}}</span>
                    <span class="gender">
                        <img class="gender_img" v-if="gender == "1"" src="/Public/images/icons/gender_male.png" />
                        <img class="gender_img" v-if="gender == "2"" src="/Public/images/icons/gender_male.png" />
                    </span>
                    
                </div>
                <div class="user-id-info text-line-height clear-both">
                    ID: S{{identifier}}
                </div>
                <div class="user-status text-line-height clear-both">
                    <i class="fa fa-envelope"></i>
                    <span class="user-tips-text">{{statusText}}</span>
                </div>
                <div class="user_address text-line-height clear-both">
                    <i class="fa fa-map-marker"></i>
                    <span class="user-tips-text">{{address}}</span>
                </div>
                
            </div>
            <!--  -->
            <div class="settings">
                <img src="/Public/img/icons/settings.png" />
                <span>SETTINGS</span>
            </div>
        </div>
    </div>
studentInfo:function(){
            var student_Info = new Vue({
                el:"-sharpstudent-info",
                data:{
                    name:"",
                    gender:"",
                    identifier:"",
                    dob:"",
                    age:"",
                    status:"",
                    statusText:"",
                    address:"",
                    imgUrl:"",
                },
                
                methods:{
                    getStudentInfo:function(){
                        var oIdentifier = getCookie("identifier");
                        var params = new URLSearchParams();
                        params.append("identifier",oIdentifier);
                        axios.post("/Student/student_base_info",params).then(response => {
                            //console.log(response.data);
                               this.name = response.data.name;
                               this.identifier = response.data.identifier;
                               this.age = myAge(response.data.dob);
                               this.gender = response.data.gender;
                               this.status = response.data.status;
                               this.statusText = courseStatus(this.status);
                               this.imgUrl = "/Upload/avatar/100_100/"+response.data.openid+".jpg"
                        });
                   },
                },
                created(){
                    this.getStudentInfo();
                },
            });
        },


axios
date()


how do bosses solve this problem

if the layout is messy, it doesn"t feel good to load it twice.
(not to mention the smile of Synchronize)


take a look at v-clock should help you


1, why the second rendering
is directly introduced into vue.js. In the .html file obtained by the
browser, the code contains {{}}, and the browser is sure to render it as {{}} first.
when vue.js executes, it traverses DOM, finds {{}} and v-instructions, and binds them in both directions.
when executing the asynchronous code you wrote, the {{}} and its contents in the DOM will be replaced by vue.js after the request, and rendered again.

2, how to solve
in your case, secondary rendering is inevitable. All you can do is make the first rendering invisible to the user. The idea of
is to set the element display: none; the first time you render, and set the element display: visible the second time you render.
vue.js provides the v-cloak instruction. The effect of this directive is that when vue.js first assigns a value to {{}}, its display is set to visible.

conclusion:
1, < div id= "student-info" class= "header-info clear-both" v-cloak >
2, add [v-cloak] {display: none;}

to your css.

use v-if
where data is bound, such as

<span v-if="this.statusText">{{this.statusText}}</span >

Menu