Commit 81dce88f authored by wdy's avatar wdy

再利用数据缓存

parent 97414985
......@@ -70,6 +70,8 @@ export default {
name: 'Role',
data() {
return {
// 缓存判断
exist: false,
form: {
pn: '',
lot: '',
......@@ -117,7 +119,17 @@ export default {
this.$refs.input1.$refs.input.focus()
})
},
// 路由跳转,是存储页面的值
beforeRouteLeave(to, from, next) {
console.log('form')
localStorage.setItem('form', JSON.stringify(this.form))
next()
},
created() {
localStorage.getItem('form') ? this.exist = true : this.exist = false
if (this.exist) {
this.form = JSON.parse(localStorage.getItem('form'))
}
},
methods: {
// 回车跳转下一个输入框
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment