uni-app提交表單到後端,接收表單數據

要想接收表單數據,首先要在表單進行數據的綁定,咱們能夠使用v-model="keyword"進行綁定。vue

而後在js獲取這個綁定的值。this

index.vuecode

<template>
<view>
    <view class="search-con">
            <view class="form-con">
            <form class="search-form">
                <input type="text" v-model="keyword" @tap="showsearchbtn" focus="true"/>
                <button form-type="submit" hover-class='none' @tap="keyword">提交</button>  
            </form>
            </view>
    </view>
</view>
<template>

jsorm

<script>
export default {
    data() {
        return {

            }
        },
        methods: {
            keyword(e){
                // 獲取表單值
                let kw = this.keyword;
                console.log(kw);
            }
        }
    }
</script>

Author:TANKING
Web:http://www.likeyun.cn
Date:2020-8-13
WeChat:face6009ip

相關文章
相關標籤/搜索