1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- import Service from "../common/service.js";
- new Vue({
- el: "#banner",
- data: {
- title: "产品中心",
- image: "",
- path_list: [
- { key: "web_about", path: "/about.html" },
- { key: "web_product", path: "/product.html" },
- { key: "web_news", path: "/news.html" },
- { key: "web_join", path: "/join.html" },
- { key: "web_contact", path: "/contact.html" },
- ],
- config: {},
- current: {},
- },
- mounted() {
- this.getConfig();
- },
- methods: {
- lan_key(val) {
- return `${val}${localStorage.getItem("language") == "en" ? "_en" : ""}`;
- },
- setTitle() {
- const path = this.path_list.find((item) =>
- location.href.includes(item.path)
- );
- if (path) {
- this.title = this.config[this.lan_key(path.key)];
- this.image = Service.baseURL + this.config[path.key + "_image"];
- }
- },
- getConfig() {
- Service.get_site()
- .then((res) => {
- this.config = res;
- this.setTitle();
- })
- .catch((err) => {
- console.log(err);
- });
- },
- },
- });
|