用vue實(shí)現(xiàn)注冊(cè)頁(yè)效果?vue實(shí)現(xiàn)短信驗(yàn)證碼登錄
本文實(shí)例為大家分享了vue實(shí)現(xiàn)注冊(cè)頁(yè)效果 的具體代碼,供大家參考,具體內(nèi)容如下
一、實(shí)現(xiàn)效果圖
??
二、實(shí)現(xiàn)代碼
1、實(shí)現(xiàn)頭部
<template> <div class="box"> <div class="box1"> <span class="iconfont icon-zuojiantou back" @click="goBack"></span> </div> <div class="box6"> <b>手機(jī)號(hào)注冊(cè)</b> </div> </div> </template> <script> export default { name: "Top", methods: { goBack() { this.$router.push("/Login"); }, }, }; </script> <style scoped> .box1 { width: 100%; height: 0.5rem; margin-bottom: 0.19rem; } span { font-size: 0.18rem; line-height: 0.5rem; font-size: 0.2rem; } .back { font-size: 0.25rem; } .box6 { width: 100%; height: 0.66rem; margin: auto; } b { font-size: 0.24rem; font-weight: normal; } p { font-size: 0.13rem; color: gray; margin-top: 0.11rem; } </style>
2、實(shí)現(xiàn)注冊(cè)內(nèi)容
<template> <div class="box"> <div class="box1"> <div class="phone-container"> <span>+86</span> <input class="userphone" type="" v-model="usernum" placeholder="請(qǐng)輸入手機(jī)號(hào)碼" /> </div> </div> <div class="box2"> <h3 @click="toSendCode">同意協(xié)議并注冊(cè)</h3> </div> <div class="box3"> <van-checkbox v-model="checked"> 已閱讀并同意以下協(xié)議:<b >淘寶平臺(tái)服務(wù)協(xié)議、隱私權(quán)政策、法律聲明、支付寶服務(wù)協(xié)議、天翼賬號(hào)認(rèn)證服務(wù)條款</b > </van-checkbox> </div> </div> </template> <script> import axios from "axios"; import Vue from "vue"; import { Checkbox, Toast } from "vant"; Vue.use(Checkbox); Vue.use(Toast); export default { name: "Num", data: function () { return { usernum: "", code: "", checked: false, }; }, methods: { // 驗(yàn)證手機(jī)號(hào) checkPhone(phone) { let reg = /^1[3|4|5|7|8][0-9]{9}$/; return reg.test(phone); }, toSendCode() { if (this.checked) { if (this.checkPhone(this.usernum)) { axios({ url: `/auth/code/?phone=${this.usernum}`, }).then((res) => { console.log(res); if (res.status == 200) { localStorage.setItem("userPhone", this.usernum); Toast("驗(yàn)證碼發(fā)送成功"); this.$router.push("/inputCode"); } }); } else { Toast("請(qǐng)檢查您的手機(jī)號(hào)"); } } else { Toast("請(qǐng)先勾選用戶(hù)協(xié)議"); } }, }, }; </script> <style scoped> .box1 { width: 100%; height: 0.7rem; } .box1 b { margin-top: 0.25rem; font-weight: normal; } .phone-container { width: 100%; padding: 0.1rem 0; margin-bottom: 0.4rem; position: relative; } .phone-container > span { position: absolute; font-size: 0.16rem; color: #666; top: 0.21rem; } input { border: none; outline: none; } input::-webkit-input-placeholder { font-size: 0.2rem; color: rgb(216, 214, 214); } .userphone { display: block; width: 100%; height: 0.4rem; box-sizing: border-box; padding: 0 0.3rem; padding-left: 0.4rem; font-size: 0.2rem; border-bottom: 0.01rem solid #eee; } .box2 { width: 100%; height: 0.5rem; margin-top: 0.2rem; } .box2 h3 { width: 100%; height: 0.4rem; background-color: yellow; border-radius: 0.15rem; font-size: 0.18rem; text-align: center; line-height: 0.3rem; margin-top: 0.1rem; font-weight: 600; line-height: 0.4rem; letter-spacing: 0.02rem; color: rgba(87, 42, 42, 0.623); } .box3 { width: 100%; height: 0.3rem; margin-top: 3.4rem; font-size: 0.12rem; } .box3 b { font-weight: normal; color: deepskyblue; } </style>
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
教你在vue項(xiàng)目中使用svg圖標(biāo)的方法
本文給大家介紹了在vue項(xiàng)目中使用svg圖標(biāo)的方法,本文通過(guò)實(shí)例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友參考下吧2022-04-04vue3成功創(chuàng)建項(xiàng)目后?run?serve啟動(dòng)項(xiàng)目報(bào)錯(cuò)的解決
這篇文章主要介紹了vue3成功創(chuàng)建項(xiàng)目后?run?serve啟動(dòng)項(xiàng)目報(bào)錯(cuò)的解決方案,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2024-03-03寫(xiě)一個(gè)移動(dòng)端慣性滑動(dòng)&回彈Vue導(dǎo)航欄組件 ly-tab
前一段時(shí)間小編寫(xiě)一個(gè)移動(dòng)端慣性滑動(dòng)&回彈Vue導(dǎo)航欄組件 ly-tab,覺(jué)的非常實(shí)用,大家可能在做項(xiàng)目時(shí)會(huì)用到,感興趣的朋友跟隨腳本之家小編一起學(xué)習(xí)吧2018-03-03vue3使用vite搭建的項(xiàng)目需要安裝的插件/配置方式
這篇文章主要介紹了vue3使用vite搭建的項(xiàng)目需要安裝的插件/配置方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2024-03-03vue cli3.0打包上線靜態(tài)資源找不到路徑的解決操作
這篇文章主要介紹了vue cli3.0打包上線靜態(tài)資源找不到路徑的解決操作,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2020-08-08解決antd 下拉框 input [defaultValue] 的值的問(wèn)題
這篇文章主要介紹了解決antd 下拉框 input [defaultValue] 的值的問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2020-10-10vue3?+?antv/x6實(shí)現(xiàn)流程圖的全過(guò)程
隨著互聯(lián)網(wǎng)的發(fā)展,越來(lái)越多的應(yīng)用需要實(shí)現(xiàn)流程圖的制作,如工作流程圖、電路圖等,文中通過(guò)代碼以及圖文將實(shí)現(xiàn)的過(guò)程介紹的非常詳細(xì),對(duì)大家學(xué)習(xí)或者工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2024-06-06