Newer
Older
smart-economy / src / components / common / Global.vue
StephanieGitHub on 26 Jan 2021 646 bytes first commit
<script>
  import axios from 'axios'
  const BASE_HTTP_URL = 'http://' + window.location.host;
  let DICT_ALL = [],loading = false,app = {
    DICT_ALL : [],
    INDUSTRY_ALL : [],
    getDictList: function (callback) {
      if(DICT_ALL.length !== 0){
        callback(DICT_ALL);
      }else{
        axios.get('/dx-economy-api/dict/all').then(resp => {
          let _data = resp.data,_temp = [];
          if (_data.code === 200) {
            _temp = _data.data;
            DICT_ALL = _data.data
          }
          callback(_temp);
        });
      }
    }
  };

  export default
  {
    BASE_HTTP_URL,DICT_ALL,loading,app
  }
</script>