zoukankan      html  css  js  c++  java
  • axios 使用

      //注册获取新的验证码
      mutations_registration_get_verificationCode(store) {
        let registration_get_code = store.state.registration.registration_get_code; //设置是否允许 获取新的求情的标志位
        let params = {
          number: 1252223333
        };
        if (!registration_get_code) {
          return false;
        }
        store.state.registration.registration_get_code = false; // 不允许发送请求
        console.log("registration_get_code");
        get("/verificationCode ", params)
          .then(response => {
            alert("then");
            console.log(response);
          })
          .catch(err => {
            alert("get err");
          });
    
        post("/verificationCode ", params)
          .then(response => {
            console.log(response);
          })
          .catch(err => {
            console.log(err);
            alert("post err");
            console.log(" error");
          }).finally(()=>{
            alert('axios end')
          })
    
        // 服务调取成功后 启动技术
        mutations_registration_set_interver(store);
        function mutations_registration_set_interver(store) {
          let time = 10;
          let store1 = store;
          let defaultText = store1.state.registration.getVerificationDefaultText;
          alert("mutations_registration_set_interver");
          let timer = setInterval(function() {
            time -= 1;
            store1.state.registration.getVerificationTimer = time;
            store1.state.registration.getVerificationText = `重发(${time}s)`;
            if (time <= 0) {
              clearInterval(timer);
              store1.state.registration.getVerificationText = defaultText;
              store.state.registration.registration_get_code = true; // 允许发送请求
            }
          }, 1000);
        }
      },
    

      

    https://www.tongbiao.xyz/
  • 相关阅读:
    小技巧:通过linux一行命令修改ip
    小技巧:textarea文本输入区内实现换行
    set 排序实例
    每日日报
    每日日报
    每日日报
    每日日报
    每日日报
    每日日报
    每日日报
  • 原文地址:https://www.cnblogs.com/tongbiao/p/9408228.html
Copyright © 2011-2022 走看看