日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學(xué)無(wú)先后,達(dá)者為師

網(wǎng)站首頁(yè) 編程語(yǔ)言 正文

前端寫(xiě)代碼的時(shí)候,不滿(mǎn)足條件程序停止執(zhí)行下面的程序,并彈窗提示

作者:migexiaoliang 更新時(shí)間: 2022-08-15 編程語(yǔ)言

項(xiàng)目場(chǎng)景:

前端寫(xiě)代碼的時(shí)候,有時(shí)候需要滿(mǎn)足條件才可以執(zhí)行下面的程序,不滿(mǎn)足條件程序停止執(zhí)行,并彈窗提示不滿(mǎn)足的原因。
在這里插入圖片描述


代碼實(shí)現(xiàn)

實(shí)現(xiàn)代碼:

      if (this.channnelConfig.user_info_change_sms == '0') {
        this.$notify({  //不滿(mǎn)足條件,彈窗提示
          message: '修改不成功',
          type: 'warning',
        });
        return;
      }

例如在項(xiàng)目中的使用:

    changeStatus(target, bomb) {
      if (this.channnelConfig.user_info_change_sms == '0') {
        this.$notify({
          message: '修改不成功',
          type: 'warning',
        });
        return;
      }
      //如果上面條件不滿(mǎn)足,下面的接口調(diào)用程序不會(huì)繼續(xù)執(zhí)行
      sendMessageReq
        .editSysConfig({
          [target]: bomb,
        })
        .then(res => {
          if () {
           .
           .
           .
            this.$notify({
              title: '成功',
              message: res.data.msg || '修改配置成功!',
              type: 'success',
            });
          }
        })
        .catch(err => {
          console.log(err);
          // 如果失敗,刷新回原來(lái)的數(shù)據(jù)
          .
          .
          .
        });
    },

原文鏈接:https://blog.csdn.net/migexiaoliang/article/details/124277070

欄目分類(lèi)
最近更新