功能说明
如果未登录,则跳转到登录组件;在登录组件中登录成功,则跳转到首页组件。用户信息在mysql数据库中。较为关键的几个点有:flask中session功能的应用和接收前端传递数据的方式、vue3中的组件跳转等。
一、前端Vue程序
1、创建登录组件Login.vue
<template>
<el-row style="margin: 0.5rem 0;">
<el-col :span="24">
<h2 style="text-align: center;font-weight: bold;">用户登录</h2>
</el-col>
</el-row>
<el-row style="margin: 0.5rem 0;">
<el-col :span="24">
<el-input v-model="un">
<template #prepend>账号</template>
</el-input>
</el-col>
</el-row>
<el-row style="margin: 0.5rem 0;">
<el-col :span="24">
<el-input v-model="pwd" type="password" show-password>
<template #prepend>密码</template>
</el-input>
</el-col>
</el-row>
<el-row style="margin: 0.5rem 0;text-align: center;">
<el-col :span="24">
<el-button type="primary" round @click="submithandle">提交</el-button>
<el-button type="info" round>重置</el