header-mobile.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import language from "../common/language.js";
  2. import Service from "../common/service.js";
  3. new Vue({
  4. el: "#header",
  5. data: {
  6. current_language: "chs",
  7. path_list: [
  8. { name: "首页", path: "/index-mobile.html" },
  9. { name: "关于我们", path: "/about-mobile.html" },
  10. { name: "产品中心", path: "/product-mobile.html" },
  11. { name: "新闻资讯", path: "/news-mobile.html" },
  12. { name: "加入我们", path: "/join-mobile.html" },
  13. // { name: "联系我们", path: "/contact-mobile.html" },
  14. ],
  15. current_path: "/index.html",
  16. baseURL: Service.baseURL,
  17. menu_show: false,
  18. config: {},
  19. logo_path: "",
  20. },
  21. mounted() {
  22. this.current_path = location.pathname;
  23. this.current_language = localStorage.getItem("language");
  24. if (!this.current_language) {
  25. this.changeLanguage("chs");
  26. }
  27. document.querySelector(".header-nav").style.display = "block";
  28. this.getConfig();
  29. },
  30. methods: {
  31. text(val) {
  32. return language[val][this.current_language];
  33. },
  34. changeLanguage(val) {
  35. localStorage.setItem("language", val);
  36. history.go(0);
  37. },
  38. getConfig() {
  39. Service.get_site()
  40. .then((res) => {
  41. this.config = res;
  42. this.logo_path = this.baseURL + res.web_logo_color;
  43. })
  44. .catch((err) => {
  45. console.log(err);
  46. });
  47. },
  48. },
  49. });