feat:添加config。json的文件
This commit is contained in:
@@ -7,25 +7,17 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import config from '../static/config.json'
|
||||
export default {
|
||||
name: 'App',
|
||||
mounted() {
|
||||
let development=process.env.NODE_ENV == 'development' ? true : false;//用于区分是本地开发还是线上环境
|
||||
console.log(process,development);
|
||||
if(development){
|
||||
this.$axios.defaults.baseURL = 'http://192.168.40.42:8080/nz-admin';
|
||||
} else{
|
||||
const Timestamp=new Date().getTime();
|
||||
this.$http.get("config.json?Timestamp="+Timestamp).then((result)=>{
|
||||
this.$axios.defaults.baseURL = result.body.baseUrl;
|
||||
const version=result.body.version;
|
||||
if(version!==localStorage.getItem('nz-version')){
|
||||
sessionStorage.clear();
|
||||
localStorage.clear();
|
||||
localStorage.setItem('nz-version',version);
|
||||
}
|
||||
});
|
||||
}
|
||||
this.$axios.defaults.baseURL =config.baseUrl;
|
||||
const version=config.version;
|
||||
if(version!==localStorage.getItem('nz-version')){
|
||||
sessionStorage.clear();
|
||||
localStorage.clear();
|
||||
localStorage.setItem('nz-version',version);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
1
nezha-fronted/static/config.json
Normal file
1
nezha-fronted/static/config.json
Normal file
@@ -0,0 +1 @@
|
||||
{"baseUrl":"http://192.168.40.42:8080/nz-admin", "version": "1.2"}
|
||||
Reference in New Issue
Block a user