您好,登錄后才能下訂單哦!
本篇內(nèi)容介紹了“怎么用vue實(shí)現(xiàn)注冊頁效果”的有關(guān)知識,在實(shí)際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領(lǐng)大家學(xué)習(xí)一下如何處理這些情況吧!希望大家仔細(xì)閱讀,能夠?qū)W有所成!
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ī)號注冊</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)注冊內(nèi)容
<template> <div class="box"> <div class="box1"> <div class="phone-container"> <span>+86</span> <input class="userphone" type="" v-model="usernum" placeholder="請輸入手機(jī)號碼" /> </div> </div> <div class="box2"> <h4 @click="toSendCode">同意協(xié)議并注冊</h4> </div> <div class="box3"> <van-checkbox v-model="checked"> 已閱讀并同意以下協(xié)議:<b >淘寶平臺服務(wù)協(xié)議、隱私權(quán)政策、法律聲明、支付寶服務(wù)協(xié)議、天翼賬號認(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ī)號 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("請檢查您的手機(jī)號"); } } else { Toast("請先勾選用戶協(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 h4 { 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>
“怎么用vue實(shí)現(xiàn)注冊頁效果”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識可以關(guān)注億速云網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實(shí)用文章!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。