如果要往Array的头部添加若干元素,使用unshift()方法,

this.$nextTick(() => {
            if (this.allPix.length > 0) {
              this.rechargeList.unshift({
                name: this.$t("PIX"),
                uname: "pix",
                img: require("../assets/images/bankcard.svg"),
                depositType: 3
              });
              this.depositType = 3;
            }
            if (this.allWallet.length > 0) {
              this.rechargeList.unshift({
                name: this.$t("电子钱包"),
                uname: "wallet",
                img: require("../assets/images/bankcard.svg"),
                depositType: 2
              });
              this.depositType = 2;
            }
            if (this.allBank.length > 0) {
              this.rechargeList.unshift({
                name: this.$t("银行卡"),
                uname: "bank",
                img: require("../assets/images/bankcard.svg"),
                depositType: 0
              });
              this.depositType = 0;
            }
            if (this.allUsdt.length > 0) {
              this.rechargeList.unshift({
                name: this.$t("USDT"),
                uname: "usdt",
                img: require("../assets/images/usdt.svg"),
                depositType: 1
              });
              this.depositType = 1;
            }
            if (this.rechargeList.length > 0) {
              this.rechargeListChange(this.rechargeList[0].name);
            }
            this.currency_defa = res.data.data.currency_defa; //货币类型
          });
		  console.log(this.rechargeList,'this.rechargeList')
        }

By lxcss

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注