var.js 647 B

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