【已解决】 前端页面刷新就会丢失页面,返回也无效?


我一次通过菜单点击用户列表请求是正常的

但是按F5刷新之后,页面就直接丢失了,请求的参数也不对,后台也报page没有传值

<template>
<div class="user-list-box">
<div class="user-search-pat">
<el-form :inline="true">
<el-form-item label="用户名" size="medium">
<el-input v-model="search.username" placeholder="请输入用户名"></el-input>
</el-form-item>
<el-form-item label="邮箱">
<el-input v-model="search.email" placeholder="请输入邮箱地址"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="doSearch">搜索</el-button>
</el-form-item>
</el-form>
</div>
<!--显示内容-->
<div class="list-box">
<el-table
:data="userList"
style="width: 100%">
<el-table-column
fixed
prop="id"
label="ID"
width="200">
</el-table-column>
<el-table-column
prop="username"
label="用户名"
width="120">
</el-table-column>
<el-table-column
prop="email"
label="邮箱"
width="120">
</el-table-column>
<el-table-column
prop="sign"
label="签名"
width="120">
</el-table-column>
<el-table-column
label="头像"
width="200">
<template slot-scope="scope">
<el-avatar size="medium" :src="scope.row.avatar"></el-avatar>
</template>
</el-table-column>
<el-table-column
label="状态"
width="120">
<template slot-scope="scope">
<div v-if="scope.row.state==='0'">
<el-tag type="danger" size="mini">不可用</el-tag>
</div>
<div v-if="scope.row.state==='1'">
<el-tag type="success" size="mini">正 常</el-tag>
</div>
</template>
</el-table-column>
<el-table-column
label="创建日期"
width="180">
<template slot-scope="scope">
<span v-text="formatDate(scope.row.createTime)"></span>
</template>
</el-table-column>
<el-table-column
label="更新日期">
<template slot-scope="scope">
<span v-text="formatDate(scope.row.updateTime)"></span>
</template>
</el-table-column>
<el-table-column
fixed="right"
label="操作"
width="200">
<template slot-scope="scope">
<el-button @click="resetPassword(scope.row)" type="primary" size="mini">重置密码</el-button>
<el-popconfirm
:hideIcon="true"
@onConfirm="deleteItem(scope.row)"
cancelButtonType="Text"
confirmButtonType="Text"
title="是否确定删除">
<el-button slot="reference" type="danger" size="mini">删除</el-button>
</el-popconfirm>
</template>
</el-table-column>
</el-table>
</div>
<div class="page-navigation-box">
<el-pagination
class="user-list-page-navigation-bar clearfix"
background
layout="prev, pager, next"
@current-change="onPageChange"
:current-page="pageNavigation.currentPage"
:page-size="pageNavigation.pageSize"
:total="pageNavigation.totalCount">
</el-pagination>
</div>
</div>
</template>
<script>
import * as dateUtils from '../../utils/date'
export default {
name: "list",
data() {
return {
search:{
username: '',
email: ''
},
userList:[],
pageNavigation: {
currentPage: 1,
totalCount: 0,
pageSize: 10
}
}
},
methods: {
formatDate(dateStr) {
let date = new Date(dateStr)
return dateUtils.formatDate(date, 'yyyy-MM-dd hh:mm:ss')
},
listUsers() {
// http://localhost:8081/user/list?page=1&size=5
this.axios.get('/user/list?page='+ this.pageNavigation.currentPage+'&size='+ this.pageNavigation.pageSize).then(result =>{
this.handleUserListResult(result)
})
},
handleUserListResult(result){
if (result.data.code === 200){
this.userList = result.data.data.list
this.pageNavigation.currentPage = result.data.data.pageNum;
this.pageNavigation.totalCount = result.data.data.total;
this.pageNavigation.pageSize = result.data.data.pageSize;
}else {
this.$message.error(result.data.message)
}
},
resetPassword(){
},
deleteItem(){
},
doSearch(){
this.$message('功能开发中');
},
onPageChange(page){
this.pageNavigation.currentPage = page;
this.listUsers()
}
},
mounted() {
this.listUsers()
}
}
</script>
<style scoped>
.clearfix{
overflow: auto;
zoom: 1;
}
.user-list-page-navigation-bar{
float: right;
margin-right: 40px;
}
.list-box{
margin-bottom: 10px;
}
</style>
是我的问题,我设置了前端跨越转发,但是我的请求也是user开头的,所以会无法请求到,
跟着视频都做不了吗?
什么时候是服务端渲染,什么时候是客户端渲染。
客户端请求渲染是不是有跨域问题,是不是要配置一下代理来解决这个问题呢?
报的是400,说明不支持该请求,处理不了。