You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
854 B
27 lines
854 B
<template>
|
|
<div>
|
|
<h2>Register</h2>
|
|
<form @submit.prevent="handleRegister">
|
|
<input type="email" v-model="email" placeholder="Email" required />
|
|
<input type="password" v-model="password" placeholder="Password" required />
|
|
<button type="submit">Register</button>
|
|
</form>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { ref } from 'vue';
|
|
import { useRouter } from 'vue-router';
|
|
import { useAuthStore } from '../stores/auth';
|
|
|
|
const email = ref('');
|
|
const password = ref('');
|
|
const router = useRouter();
|
|
const authStore = useAuthStore();
|
|
|
|
function handleRegister() {
|
|
// 这里可以添加实际的注册逻辑
|
|
// 注册成功后也可以调用authStore.login()方法并跳转到首页
|
|
router.push({ name: 'Login' }); // 注册成功后重定向到登录页面
|
|
}
|
|
</script> |