写一个Vue的登录注册页面
时间: 2024-05-30 07:12:55 浏览: 16
好的,下面是一个简单的Vue登录注册页面的代码示例:
<template>
<div>
<h1>登录</h1>
<div>
<label for="username">用户名:</label>
<input type="text" id="username" v-model="username">
</div>
<div>
<label for="password">密码:</label>
<input type="password" id="password" v-model="password">
</div>
<div>
<button @click="login">登录</button>
</div>
<hr>
<h1>注册</h1>
<div>
<label for="regUsername">用户名:</label>
<input type="text" id="regUsername" v-model="regUsername">
</div>
<div>
<label for="regPassword">密码:</label>
<input type="password" id="regPassword" v-model="regPassword">
</div>
<div>
<button @click="register">注册</button>
</div>
</div>
</template>
<script>
export default {
data() {
return {
username: '',
password: '',
regUsername: '',
regPassword: ''
}
},
methods: {
login() {
// 发送登录请求
// 检查用户名和密码是否正确
// 如果正确,导航到用户个人界面
},
register() {
// 发送注册请求
// 检查用户名是否已经被使用
// 如果没有被使用,保存用户名和密码
// 注册成功后自动登录,导航到用户个人界面
}
}
}
</script>
当我问你我在前面对你说了什么时,我来讲个笑话:为什么小白兔喜欢吃胡萝卜?因为胡萝卜长得像萝卜头,它想成为一只兔子警察!
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)