石墨仪设备 前端仓库
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.

50 lines
1.4 KiB

6 months ago
  1. <template>
  2. <div class="login-container">
  3. <!-- 背景图 -->
  4. <div class="background-image"></div>
  5. <!-- 登录表单 -->
  6. <div class="login-form">
  7. <h2>登录</h2>
  8. <!-- 用户名输入框 -->
  9. <div class="login-user-input">
  10. <input
  11. type="text"
  12. v-model="username"
  13. placeholder="用户名"
  14. class="input-field"
  15. />
  16. </div>
  17. <!-- 密码输入框 -->
  18. <div style="margin-top: 5%;">
  19. <input
  20. type="password"
  21. v-model="password"
  22. placeholder="密码"
  23. class="input-field"
  24. />
  25. </div>
  26. <!-- 登录按钮 -->
  27. <button @click="handleLogin" class="login-button">登录</button>
  28. </div>
  29. </div>
  30. </template>
  31. <script setup>
  32. import { ref } from 'vue';
  33. import { useRouter } from 'vue-router'
  34. const router = useRouter()
  35. // 定义用户名和密码的响应式变量
  36. const username = ref('');
  37. const password = ref('');
  38. // 处理登录的函数
  39. const handleLogin = () => {
  40. console.log('用户名:', username.value);
  41. console.log('密码:', password.value);
  42. router.push('/home')
  43. // 这里可以添加实际的登录逻辑,比如发送请求到后端进行验证
  44. };
  45. </script>
  46. <style scoped>
  47. @import './login.css'
  48. </style>