vue獲取form表單的值示例
更新時間:2019年10月29日 17:04:45 作者:即墨丹青
今天小編就為大家分享一篇vue獲取form表單的值示例,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
這里使用的是Element-ui組件
html:
<el-input placeholder="請輸入手機號" id="phone" prop="phone" v-model="phone" clearable></el-input>
JS:
var phone = this.phone;
var password = this.password;
var that = this;
var phone = that .phone;
var password = that .password;
this.$axios({
method:'post',
url:'api/user/logout',
data:this.qs.stringify({phone:phone,password:password})
}).then((res) =>{ //這里使用了ES6的語法
if (res.data.status==200){
alert(res.data.message);
this.$emit('userSignIn', ''); //記錄登錄狀態(tài)
this.$router.replace({path: '/login'}); //成功后跳轉(zhuǎn)
}
}).catch((error) =>{
alert(error.data.message) //請求失敗返回的數(shù)據(jù)
})
以上這篇vue獲取form表單的值示例就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持腳本之家。
相關(guān)文章
vue中循環(huán)多個li(表格)并獲取對應(yīng)的ref的操作代碼
我想要獲取每一個循環(huán)并獲取每一個li(或者其它循環(huán)項)的ref,以便于后續(xù)的操作,接下來通過本文給大家分享vue中循環(huán)多個li(表格)并獲取對應(yīng)的ref的操作代碼,感興趣的朋友跟隨小編一起看看吧2024-02-02
vue項目接入高德地圖點擊地圖獲取經(jīng)緯度以及省市區(qū)功能
這篇文章主要給大家介紹了關(guān)于vue項目接入高德地圖點擊地圖獲取經(jīng)緯度以及省市區(qū)功能的相關(guān)資料,開發(fā)中我們需要地圖定位,就是用戶輸入位置,自動定位獲取經(jīng)緯度,需要的朋友可以參考下2023-08-08

