get() { let _this = this _this.value = sessionStorage.getItem("status") console.log('当前登录的用户的值为' + _this.value) }, clickMatch(item) { this.$router.push({ path: "/HeventProfile", query: { item: JSON.stringify(item) } }) }, search() { selectKeyWord(this.state).then(({ data }) => { this.cardMatch = data }) }, theSchool() { selectMySchool(this.school).then(({ data }) => { this.cardMatch = data }) }, allSchool() { selectAllSchool().then(({ data }) => { this.cardMatch = data }) }, selectBall(item){ console.log(item) selectByType(item).then(({data})=>{ this.cardMatch = data }) }, selectNotstart(){ selectNotStart().then(({data})=>{ this.cardMatch = data }) }, selectunderway(){ selectUnderway().then(({data})=>{ this.cardMatch = data }) }, selectend(){ selectEnd().then(({data})=>{ this.cardMatch = data }) }, }
时间: 2024-04-26 18:24:01 浏览: 8
这段代码可能是一个前端Vue.js应用程序中的一部分。它包含了一些函数,例如:
- get(): 该函数从sessionStorage中获取名为"status"的值,并将其存储在当前组件的value属性中。
- clickMatch(item): 该函数会将用户导航到"/HeventProfile"路由,并将选定的项目作为参数传递。
- search(): 该函数会调用API函数selectKeyWord(),并将返回的数据存储在cardMatch属性中。
- theSchool(): 该函数会调用API函数selectMySchool(),并将返回的数据存储在cardMatch属性中。
- allSchool(): 该函数会调用API函数selectAllSchool(),并将返回的数据存储在cardMatch属性中。
- selectBall(item): 该函数会调用API函数selectByType(),并将返回的数据存储在cardMatch属性中。
- selectNotstart(): 该函数会调用API函数selectNotStart(),并将返回的数据存储在cardMatch属性中。
- selectunderway(): 该函数会调用API函数selectUnderway(),并将返回的数据存储在cardMatch属性中。
- selectend(): 该函数会调用API函数selectEnd(),并将返回的数据存储在cardMatch属性中。
这些函数可能会在用户与应用程序交互时被调用,例如用户点击按钮或导航到不同的页面。
相关问题
console.log('sessionStorage===',sessionStorage.getItem('token'))是空的怎么解决
如果 `sessionStorage.getItem('token')` 返回空,可能有以下几种原因:
1. 在使用 `sessionStorage.setItem('token', value)` 方法设置 `token` 值时出错,导致存储失败。你可以通过 `console.log('sessionStorage===', sessionStorage)` 查看 sessionStorage 中是否存在 `token` 键,以及它的值是否正确。
2. `token` 值已经过期或者被删除了。`sessionStorage` 中存储的数据只在当前会话有效,如果用户关闭了浏览器或者打开了一个新的标签页,那么 `sessionStorage` 中存储的数据就会被清空。
3. `sessionStorage` 功能被禁用了。一些浏览器可能会禁用 `sessionStorage` 功能,你可以尝试在浏览器控制台中输入 `sessionStorage.setItem('test', 'test')` 看看是否会报错。
如果以上方法都无法解决问题,你可以考虑使用其他的存储方式,比如 `localStorage` 或者 `cookie`。
handleSizeChange(val) { console.log(`每页 ${val} 条`); var _this = this _this.pageSize = val _this.token = sessionStorage.getItem("token") axios.get('http://localhost:8082/event/eventForm?page=' + _this.page +'&pageSize=' +_this.pageSize, { headers:{ 'token': _this.token } }) .then(function (ref) { console.log(ref.data) _this.tableData = ref.data.data.records _this.total = ref.data.data.total-0 }) }, handleCurrentChange(val) { console.log(`当前页: ${val}`); var _this = this _this.token = sessionStorage.getItem("token") _this.page = val axios.get('http://localhost:8082/event/eventForm?page=' + _this.page +'&pageSize=' +_this.pageSize, { headers:{ 'token': _this.token } }) .then(function (ref) { console.log(ref.data) _this.tableData = ref.data.data.records _this.total = ref.data.data.total-0 }) },
这是一个使用了 Vue.js 和 Axios 库的前端分页查询的方法。其中,handleSizeChange 方法用于在每页显示条数发生变化时触发,通过发送请求到后端,获取指定页码和指定每页显示条数的数据,同时更新表格的数据和总记录数。handleCurrentChange 方法用于在当前页发生变化时触发,同样通过发送请求到后端,获取指定页码和指定每页显示条数的数据,同时更新表格的数据和总记录数。这个分页查询的实现需要后端提供相应的接口支持,同时需要前端进行相应的参数配置和数据渲染。