The data in the Vue background can be obtained, but it cannot be bound to select option.

html Code:

  <div class="containter">
     <form action="" class="form-inline">
         <div class="form-group">
              <label for="-sharpgrade">:</label>
              <select name="" id="grade" class="form-control"  v-on:change="selectGrade($event)">
                   <option v-for="grade in this.gradeList" v-bind:id="grade.id" v-bind:value="grade.id">{{grade.name}}</option>
              </select>
          </div>
          <div class="form-group">
              <label for="-sharpclazz">:</label>
              <select name="" id="clazz" class="form-control">
                    <option v-for="clazz in this.clazzList">{{clazz.name}}</option>
              </select>
          </div>    
       </form>
     </div>

script Code:

new Vue({
    el:".containter",
    data:{
        gradeList:[],
        clazzList:[],    
    },
// 
    created(){
        // 
        $.getJSON("http://120.78.164.247:8080/grade/findAll",(result)=>{
            $("-sharpgrade").empty();
            this.gradeList = result.extend.data;     
            var currentGradeId = this.gradeList[0].id;
   
        // 
            $.getJSON("http://120.78.164.247:8080/clazz/findByGradeId",{id:currentGradeId},function(result){
                  this.clazzList = result.extend.data; 
                  console.log(this.clazzList);
            })
        });

the following is the effect:

the value of the first option can be displayed, and the second option can be obtained in the same way as the first one, but not displayed on the page. Please take a look at it. Thank you. The background data is written by the classmate. Please ignore it, not intentionally. )

Mar.13,2021

the callback in the second request is changed to the arrow function:

$.getJSON('http://120.78.164.247:8080/clazz/findByGradeId',{id:currentGradeId}, result => {
    this.clazzList = result.extend.data; 
    console.log(this.clazzList);
})

this points to the problem with the arrow function

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1be9fab-319b4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1be9fab-319b4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?