vue element checkbox 根据数组内容选中checkbox

template

 
                  
                  
                  
                  亚洲
                  
                
                {{city.value}}
              
            

JS

 getAreaUser() {
      var areaCon = this.$route.query.row.areas;
      console.log("321123", areaCon);
      for (var i = 0; i < areaCon.length; i++) {
            if (areaCon[i].parentArea.id == 2) {
               this.checkedCitiesAsia.push(areaCon[i].id);
            } else if (areaCon[i].parentArea.id == 3) {
              this.checkedCitiesEurope.push(areaCon[i].id);
            } else if (areaCon[i].parentArea.id == 4) {
              this.checkedCitiesNAmerica.push(areaCon[i].id);
            } else if (areaCon[i].parentArea.id == 5) {
              this.checkedCitiesSAmerica.push(areaCon[i].id);
            } else if (areaCon[i].parentArea.id == 6) {
               this.checkedCitiesOcea.push(areaCon[i].id);
            } else if (areaCon[i].parentArea.id == 7) {
               this.checkedCitiesAfrica.push(areaCon[i].id);
            } else {
              console.log("区域报错11");
            }
          }

你可能感兴趣的:(vue)