12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- import language from "../common/language.js";
- import Service from "../common/service.js";
- new Vue({
- el: "#header",
- data: {
- current_language: "chs",
- path_list: [
- { name: "首页", path: "/index-mobile.html" },
- { name: "关于我们", path: "/about-mobile.html" },
- { name: "产品中心", path: "/product-mobile.html" },
- { name: "新闻资讯", path: "/news-mobile.html" },
- { name: "加入我们", path: "/join-mobile.html" },
-
- ],
- current_path: "/index.html",
- baseURL: Service.baseURL,
- menu_show: false,
- config: {},
- logo_path: "",
- },
- mounted() {
- this.current_path = location.pathname;
- this.current_language = localStorage.getItem("language");
- if (!this.current_language) {
- this.changeLanguage("chs");
- }
- document.querySelector(".header-nav").style.display = "block";
- this.getConfig();
- },
- methods: {
- text(val) {
- return language[val][this.current_language];
- },
- changeLanguage(val) {
- localStorage.setItem("language", val);
- history.go(0);
- },
- getConfig() {
- Service.get_site()
- .then((res) => {
- this.config = res;
- this.logo_path = this.baseURL + res.web_logo_color;
- })
- .catch((err) => {
- console.log(err);
- });
- },
- },
- });
|