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

2020-8-16    seo達人

要想接收表單數據,首先要在表單進行數據的綁定,我們可以使用v-model="keyword"進行綁定。


然后在js獲取這個綁定的值。


index.vue


<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>

js


<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:face6009

藍藍設計sillybuy.com )是一家專注而深入的界面設計公司,為期望卓越的國內外企業(yè)提供卓越的UI界面設計、BS界面設計 、 cs界面設計 、 ipad界面設計 、 包裝設計 、 圖標定制 、 用戶體驗 、交互設計、 網站建設 平面設計服務

分享本文至:

日歷

鏈接

個人資料

藍藍設計的小編 http://sillybuy.com

存檔