开发者

How to loop for the items in a v-selectbox

Currently, I am facing a problem which is I have 3 adults and 1 infant for the flight selection. And when I come to the passenger details and there is a box to set for the infant which travels along with the adult. And this is the problem I face on how to set the option depending on how many adults are selected instead of only adult 1.

travelWith() {
      let travellerlist = [];
      let adults = this.passengers.filter(
        (x) =>
          x.PaxType === "ADT" ||
          x.SSR.Outbound.filter((y) => {
            return y.codeType === "INFT";
          }).length > 0
      );
        if (adults.length > 0) {
        let adult = adults[this.index];
        if (!adult.FirstName) {
          var travel = "Adult " + (this.index + 1);
          travellerlist.push(travel);
        } else if (!adult.FirstName == "" && !adult.LastName == "") {
          var travel = "Adult " + (this.index + 1) + " " + adult.Title + " " + adult.FirstName + " " + adult.LastName;
          travellerlist.push(travel);
        }
        return travellerlist;
      } 
      el开发者_如何学编程se {
        return travellerlist;
      }
    }, 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜