最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

最適應(yīng)的vue.js的form提交涉及多種插件【推薦】

 更新時(shí)間:2018年08月27日 11:09:36   作者:新葉之扉之丹兒  
這篇文章主要介紹了最適應(yīng)的vue.js的form提交涉及多種插件,涉及到 vue.js動(dòng)態(tài)添加css樣式 ,tab切換 ,touch,表單提交,驗(yàn)證,toast,數(shù)據(jù)雙向綁定等。需要的朋友可以參考下

基于vue.js這里寫了一個(gè)小列子;涉及到 vue.js動(dòng)態(tài)添加css樣式 ,tab切換 ,touch,表單提交,驗(yàn)證,toast,數(shù)據(jù)雙向綁定等。

先上效果圖再一一講解:

一、首先用到的是動(dòng)態(tài)修改css

點(diǎn)擊X將隱藏溫馨提示:

1.先給整個(gè)div綁定 v-bind

<div class="rz-notice" v-bind:style="{ display: isno}">
    <p>名片用來鑒別是相關(guān)人員,溫馨提示:<img src="../assets/static/img-icon/lan_cha.png" @click="hiddenwords"></p>
 </div>

注釋:圖片地址為你自己的地址

<div class="rz-notice" v-bind:style="{ display: isno}">
 <p>名片用來鑒別是相關(guān)人員,溫馨提示:
  <img src="../assets/static/imgicon/lan_cha.png" @click="hiddenwords"></p>
</div>

2.在data里定義

isno:'block',:

3.寫click事件方法

methods: {
  hiddenwords() {
  this.isno = 'none'
  },
}

一個(gè)簡單的點(diǎn)擊設(shè)置樣式為none便寫好了。

根據(jù)你的業(yè)務(wù)需求寫你動(dòng)態(tài)添加的樣式;方法都是一樣的。

二、下面寫提交時(shí)最常見驗(yàn)證

Toast樣式 我根據(jù)自己的主題色進(jìn)行了修改

Toast引入import { Toast } from 'vant'

2.1 這里涉及到了v-modal 數(shù)據(jù)雙向綁定

<div class="my-content-list">
 <div class="color-black"><span style="margin-right: 0.6rem;">
  真實(shí)姓名:</span><input v-model="yoursname" placeholder="請輸入您的真實(shí)姓名" /></div>
</div>
<div class="my-content-list">
 <div class="color-black"><span style="margin-right: 0.6rem;">手機(jī)號碼:</span>
 <input v-model="yoursphone" placeholder="請輸入您的手機(jī)號碼" /></div>
</div>
<div class="yzbtn" @click="submitBtn">立即認(rèn)證</div>

2.2在data定義 yoursname和yoursphone的初始值

yoursname: ' ',
 yoursphone: ' ',

2.3寫方法z

submitBtn() {
 var reg = /^1[3|4|5|8][0-9]\d{4,8}$/;
 if(this.yoursname == '') {
 Toast("請?zhí)顚懩愕恼鎸?shí)姓名");
 return;
 }
 if(this.yoursphone == '' || this.yoursphone == null) {
 Toast("請?zhí)顚懩愕氖謾C(jī)號碼");
 return;
 }
 if(!reg.test(this.yoursphone)) {
 Toast('手機(jī)號碼格式不正確');
 return;
 }
},

圖片上傳以及預(yù)覽圖片將在下一篇文章中講到 每周都會(huì)更新一些小列子以及插件方法

最后附上整個(gè)代碼

歡迎提出你寶貴的意見 一同進(jìn)步 ​

<template>
 <div class="renzheng">
 <div class="rz-notice" v-bind:style="{ display: isno}">
 <p>名片用來鑒別是相關(guān)人員,溫馨提示:<img src="../assets/static/img-icon/lan_cha.png" @click="hiddenwords"></p>
 </div>
 <van-tabs v-model="active" swipeable>
 <van-tab v-for="(item,index) in navArr" :title="item.name" class="v-tab">
 <div v-if="index==0">
  <div class="color-black" style="text-align: center;margin-top: 0.4rem;">請上傳本人名片照片</div>
  <div class="rz-picter">
  <img src="../assets/jia.jpg" />
  <p><input type="file" style="display: none;" >上傳圖片</p>
  </div>
  <div class="cuxian"></div>
  <!--
      作者:1150801771@qq.com
      時(shí)間:2018-08-24
      描述:form表單
      -->
  <div class="my-content-list">
  <div class="color-black"><span style="margin-right: 0.6rem;">真實(shí)姓名:</span><input v-model="yoursname" placeholder="請輸入您的真實(shí)姓名" /></div>
  </div>
  <div class="my-content-list">
  <div class="color-black"><span style="margin-right: 0.6rem;">手機(jī)號碼:</span><input v-model="yoursphone" placeholder="請輸入您的手機(jī)號碼" /></div>
  </div>
  <div class="yzbtn" @click="submitBtn">
  立即認(rèn)證
  </div>
 </div>
 <div v-if="index==1">
  <div class="color-black" style="text-align: center;margin-top: 0.4rem;">請上傳本人身份證照片</div>
  <div class="rz-picter">
  <img src="../assets/jia.jpg" />
  <p>上傳人像頁</p>
  </div>
  <div class="rz-picter">
  <img src="../assets/jia.jpg" />
  <p>上傳國輝頁</p>
  </div>
  <div class="cuxian"></div>
  <div class="my-content-list">
  <div class="color-black"><span style="margin-right: 0.6rem;">真實(shí)姓名:</span><input placeholder="請輸入您的真實(shí)姓名" /></div>
  </div>
  <div class="my-content-list">
  <div class="color-black"><span style="margin-right: 0.6rem;">手機(jī)號碼:</span><input type="number" placeholder="請輸入您的手機(jī)號碼" /></div>
  </div>
  <div class="yzbtn">
  立即認(rèn)證
  </div>
 </div>
 </van-tab>
 </van-tabs>
 </div>
</template>
<script>
 import { Tab, Tabs } from 'vant';
 import { Toast } from 'vant'
 export default {
 name: 'renzheng',
 data() {
 return {
 yoursname: '',
 yoursphone: '',
 
 isno:'block',
 active: 0,
 navArr: [{
  name: "身份認(rèn)證"
  },
  {
  name: "實(shí)名認(rèn)證"
  }
 ],
 }
 },
 methods: {
 hiddenwords() {
 this.isno = 'none'
 },
 submitBtn() {
 var reg = /^1[3|4|5|8][0-9]\d{4,8}$/;
 if(this.yoursname == '') {
  Toast("請?zhí)顚懩愕恼鎸?shí)姓名");
  return;
 }
 if(this.yoursphone == '' || this.yoursphone == null) {
  Toast("請?zhí)顚懩愕氖謾C(jī)號碼");
  return;
 }
 if(!reg.test(this.yoursphone)) {
  Toast('手機(jī)號碼格式不正確');
  return;
 }
 },
 
 }
 }
</script>
<style>
 .rz-notice {
 padding: 0.2rem 0.3rem;
 display: flex;
 flex-direction: row;
 justify-content: space-between;
 align-items: center;
 background: #F0F5FB;
 color: #28D9EF;
 }
 
 .rz-notice img {
 height: 0.22rem;
 width: 0.22rem;
 }
 
 .rz-picter {
 height: 3rem;
 width: 6rem;
 margin: 0.3rem auto;
 border: 0.01rem solid #ededed;
 display: flex;
 flex-direction: column;
 align-items: center;
 justify-content: center;
 }
 /*立即驗(yàn)證*/
 
 .yzbtn {
 width: 90%;
 height: 0.8rem;
 background: #FF6600;
 border-radius: 0.06rem;
 margin: 30px auto;
 text-align: center;
 line-height: 0.8rem;
 color: #FFFFFF
 }
 /*修改原有tab樣式*/
 
 .van-tab {
 color: #A3A3A3!important;
 }
 
 .van-tab--active {
 color: #000!important;
 }
 
 .van-tabs__line {
 background-color: #FF6600!important;
 width: 0.7rem!important;
 text-align: center!important;
 align-items: center;
 margin-left: 1.5rem;
 }
 
 .van-toast {
 background-color: #FF6600;
 color: #FFFFFF
 }
 
 .my-content-list {
 padding: 0.3rem;
 display: flex;
 flex-direction: row;
 justify-content: space-between;
 border-bottom: 0.01rem solid #EDEDED;
 }
</style>

總結(jié)

以上所述是小編給大家介紹的最適應(yīng)的vue.js的form提交涉及多種插件,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!

相關(guān)文章

  • vue.js,ajax渲染頁面的實(shí)例

    vue.js,ajax渲染頁面的實(shí)例

    下面小編就為大家分享一篇vue.js,ajax渲染頁面的實(shí)例,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2018-02-02
  • Vue 中v-model的完整用法及v-model的實(shí)現(xiàn)原理解析

    Vue 中v-model的完整用法及v-model的實(shí)現(xiàn)原理解析

    這篇文章詳細(xì)介紹了Vue.js中的v-model指令的使用,包括基本用法、原理、結(jié)合不同類型的表單元素(如radio、checkbox、select)以及使用修飾符(如lazy、number、trim)等,感興趣的朋友一起看看吧
    2025-02-02
  • vue引入swiper插件的使用實(shí)例

    vue引入swiper插件的使用實(shí)例

    本篇文章主要介紹了vue引入swiper插件的使用實(shí)例,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2017-07-07
  • 詳解Vue組件實(shí)現(xiàn)tips的總結(jié)

    詳解Vue組件實(shí)現(xiàn)tips的總結(jié)

    這篇文章主要介紹了詳解Vue組件實(shí)現(xiàn)tips的總結(jié),小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2017-11-11
  • 一文了解vue-router之hash模式和history模式

    一文了解vue-router之hash模式和history模式

    這篇文章主要介紹了一文了解vue-router之hash模式和history模式,本文通過實(shí)例代碼給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2019-05-05
  • Vue3中是如何實(shí)現(xiàn)數(shù)據(jù)響應(yīng)式示例詳解

    Vue3中是如何實(shí)現(xiàn)數(shù)據(jù)響應(yīng)式示例詳解

    這篇文章主要介紹了Vue3中是如何實(shí)現(xiàn)數(shù)據(jù)響應(yīng)式示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-07-07
  • VUE中如何調(diào)用高德地圖獲取當(dāng)前位置(VUE2.0和3.0通用)

    VUE中如何調(diào)用高德地圖獲取當(dāng)前位置(VUE2.0和3.0通用)

    使用uniapp開發(fā)微信小程序時(shí),多多少少會(huì)遇到獲取當(dāng)前位置的詳細(xì)信息,下面這篇文章主要給大家介紹了關(guān)于VUE中如何調(diào)用高德地圖獲取當(dāng)前位置(VUE2.0和3.0通用)的相關(guān)資料,需要的朋友可以參考下
    2023-04-04
  • Vue狀態(tài)管理工具Vuex工作原理解析

    Vue狀態(tài)管理工具Vuex工作原理解析

    Vuex是一個(gè)專為Vue.js應(yīng)用程序開發(fā)的狀態(tài)管理模式,下面這篇文章主要給大家介紹了關(guān)于Vue中狀態(tài)管理器(vuex)詳解以及實(shí)際應(yīng)用場景的相關(guān)資料,文中通過實(shí)例代碼介紹的非常詳細(xì),需要的朋友可以參考下
    2023-02-02
  • Vue 2.0的數(shù)據(jù)依賴實(shí)現(xiàn)原理代碼簡析

    Vue 2.0的數(shù)據(jù)依賴實(shí)現(xiàn)原理代碼簡析

    本篇文章主要介紹了Vue 2.0的數(shù)據(jù)依賴實(shí)現(xiàn)原理代碼簡析,主要從初始化的數(shù)據(jù)層面上分析了Vue是如何管理依賴來到達(dá)數(shù)據(jù)的動(dòng)態(tài)響應(yīng),有興趣的可以了解一下
    2017-07-07
  • vue1.0和vue2.0的watch監(jiān)聽事件寫法詳解

    vue1.0和vue2.0的watch監(jiān)聽事件寫法詳解

    今天小編就為大家分享一篇vue1.0和vue2.0的watch監(jiān)聽事件寫法詳解,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2018-09-09

最新評論

佛山市| 澄城县| 南雄市| 广元市| 定日县| 寿阳县| 泽州县| 晋城| 吉林市| 义马市| 武夷山市| 诸城市| 宁陵县| 大庆市| 汤阴县| 抚顺市| 大名县| 温泉县| 盐津县| 随州市| 平山县| 九龙坡区| 顺昌县| 南通市| 灵台县| 英德市| 永年县| 黎川县| 灵石县| 许昌市| 铜川市| 儋州市| 华阴市| 冀州市| 南康市| 姚安县| 永嘉县| 崇信县| 甘南县| 蒙阴县| 保靖县|