基于vue框架如何实现手机号码直接注册登录
Admin 2022-07-08 群英技术资讯 970 次浏览
这篇文章主要讲解了“基于vue框架如何实现手机号码直接注册登录”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“基于vue框架如何实现手机号码直接注册登录”吧!本文实例为大家分享了vue实现注册页效果 的具体代码,供大家参考,具体内容如下

1、实现头部
<template>
<div class="box">
<div class="box1">
<span class="iconfont icon-zuojiantou back" @click="goBack"></span>
</div>
<div class="box6">
<b>手机号注册</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、实现注册内容
<template>
<div class="box">
<div class="box1">
<div class="phone-container">
<span>+86</span>
<input
class="userphone"
type=""
v-model="usernum"
placeholder="请输入手机号码"
/>
</div>
</div>
<div class="box2">
<h3 @click="toSendCode">同意协议并注册</h3>
</div>
<div class="box3">
<van-checkbox v-model="checked">
已阅读并同意以下协议:<b
>淘宝平台服务协议、隐私权政策、法律声明、支付宝服务协议、天翼账号认证服务条款</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: {
// 验证手机号
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("验证码发送成功");
this.$router.push("/inputCode");
}
});
} else {
Toast("请检查您的手机号");
}
} else {
Toast("请先勾选用户协议");
}
},
},
};
</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>
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:mmqy2019@163.com进行举报,并提供相关证据,查实之后,将立刻删除涉嫌侵权内容。
猜你喜欢
如何使用Node.js进行爬取?下面本篇文章带大家聊聊使用Node.js开发一个简单图片爬取功能,希望对大家有所帮助!
使用react实现一个tab组件的方法:1、通过“export default props => {...}”方式创建TAB button组件;2、通过“tab-group-layout.js”组件来传“tabIndex”,并设置默认选中的tab效果;3、用react继承“react.component”组件里的onMouseOver和OnMouseOut方法即可。
这篇文章给大家分享的是jQuery实现轮播效果的示例。小编觉得挺实用的,因此分享给大家做个参考,文中的示例代码介绍得很详细,有需要的朋友可以参考,接下来就跟随小编一起了解看看吧。
这篇文章主要为大家详细介绍了微信小程序自定义复选框,文中示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
这篇文章给大家分享的是有关用vue实现简单的点击翻转动画效果,点击翻转效果在网页设计中也比较常见,小编觉得挺实用的,因此分享给大家做个参考,接下来一起跟随小编看看吧。
成为群英会员,开启智能安全云计算之旅
立即注册关注或联系群英网络
7x24小时售前:400-678-4567
7x24小时售后:0668-2555666
24小时QQ客服
群英微信公众号
CNNIC域名投诉举报处理平台
服务电话:010-58813000
服务邮箱:service@cnnic.cn
投诉与建议:0668-2555555
Copyright © QY Network Company Ltd. All Rights Reserved. 2003-2020 群英 版权所有
增值电信经营许可证 : B1.B2-20140078 ICP核准(ICP备案)粤ICP备09006778号 域名注册商资质 粤 D3.1-20240008