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.
48 lines
1.3 KiB
48 lines
1.3 KiB
<template> |
|
<div id="app"> |
|
<el-radio-group v-if="Setting.isDev" class="ip" v-model="ip" @change="ipChange"> |
|
<el-radio :label="0">刘榕ip</el-radio> |
|
<el-radio :label="1">陈赓ip</el-radio> |
|
<el-radio :label="2">测试服ip</el-radio> |
|
</el-radio-group> |
|
<router-view></router-view> |
|
</div> |
|
</template> |
|
|
|
<script> |
|
import Setting from '@/setting' |
|
export default { |
|
name: 'App', |
|
data () { |
|
return { |
|
Setting, |
|
ip: localStorage.getItem('ip') ? +localStorage.getItem('ip') : 0, |
|
}; |
|
}, |
|
created () { |
|
window.exitSystem = () => { |
|
sessionStorage.removeItem('token') |
|
location.reload() |
|
} |
|
//在页面加载时读取sessionStorage里的状态信息 |
|
if (sessionStorage.getItem("store")) { |
|
this.$store.replaceState(Object.assign({}, this.$store.state, JSON.parse(sessionStorage.getItem("store")))) |
|
} |
|
|
|
//在页面刷新时将vuex里的信息保存到sessionStorage里 |
|
window.addEventListener("beforeunload", () => { |
|
sessionStorage.getItem("token") && sessionStorage.setItem("store", JSON.stringify(this.$store.state)) |
|
}) |
|
}, |
|
methods: { |
|
ipChange (val) { |
|
localStorage.setItem('ip', val) |
|
location.reload() |
|
}, |
|
} |
|
} |
|
</script> |
|
|
|
<style> |
|
@import "./assets/css/main.css"; |
|
</style> |