var.js 767 B

12345678910111213141516171819202122232425
  1. import Vue from 'vue';
  2. import _ from 'lodash';
  3. const getSiteId = () => {
  4. let host = `${window.location.hostname}`; //`999991.smart.jilinjobswx.cn ${window.location.hostname}`
  5. let schId;
  6. host = host.replace('http://', '');
  7. let arr = host.split('.');
  8. if (arr.length > 0) {
  9. schId = arr[0];
  10. if (schId === 'smart') schId = 'master';
  11. else `${schId}`.includes('localhost') || `${schId}`.includes('127.0.0.1') ? (schId = '99991') : '';
  12. sessionStorage.setItem('schId', `${schId}`.includes('localhost') || `${schId}`.includes('127.0.0.1') ? '99991' : schId);
  13. }
  14. return schId;
  15. };
  16. const Plugin = {
  17. install(vue, options) {
  18. // 4. 添加实例方法
  19. vue.prototype.$limit = 10;
  20. vue.prototype.$site = getSiteId();
  21. },
  22. };
  23. Vue.use(Plugin);