通過vue router-link 點擊事件請求


              <span>用戶登陸</span>
           </div>
           <form action="https://api.it120.cc/small4/user/m/login?deviceId=007&deviceName=monkey"    method="post">
    賬戶: <input type="text" name="mobile">
    密碼: <input type="password" name="pwd">
    <!-- <input type="submit" @click="logo()"> -->
    <router-link  @click.native="logo" to="">提交</router-link>
</form>
        </template>
記住router-link點擊觸發事件必須寫  native否則觸發不了
然后在methods:{   添加
logo(){
            console.log(123456)
   
      axios({
           methods:"post",
            url: 'https://api.it120.cc/small4/user/m/login?deviceId=007&deviceName=monkey',
             params:{
                  mobile:13500000000,
                  pwd:12345
              }
      }).then(res=>console.log(res))
}
      接着觸發     就會獲取到相對應的參數了

 

 僅供參考。謝謝。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM