Przeglądaj źródła

获取域名保存到session中

lrf402788946 5 lat temu
rodzic
commit
8b39191ae9
1 zmienionych plików z 12 dodań i 0 usunięć
  1. 12 0
      src/App.vue

+ 12 - 0
src/App.vue

@@ -3,6 +3,18 @@
     <router-view />
   </div>
 </template>
+<script>
+export default {
+  created() {
+    let host = `${window.location.hostname}`; //`999991.smart.jilinjobswx.cn`
+    let arr = host.split('.');
+    if (arr.length > 0) {
+      let schId = arr[0];
+      sessionStorage.setItem('schId', schId);
+    }
+  },
+};
+</script>
 
 <style lang="less">
 body {