123456789101112131415161718192021222324252627282930313233 |
- import Service from "./common/service.js";
- new Vue({
- el: "#app",
- data: {
- info: {},
- },
- mounted() {
- const type = location.href.split("?type=")[1];
- this.getDetail(type);
- },
- methods: {
- lan_key(val) {
- return `${val}${localStorage.getItem("language") == "en" ? "_en" : ""}`;
- },
- getDetail(type) {
- Service.get_site()
- .then((res) => {
- this.info = res[`agreement_` + type];
- })
- .catch((err) => {
- console.log(err);
- });
- },
- downloadFile() {
- const a = document.createElement("a");
- a.href = Service.baseURL + this.info.url;
- a.download = decodeURI(this.info[this.lan_key("url_name")] + ".docx");
- document.body.appendChild(a);
- a.click();
- document.body.removeChild(a); // 下载完移除元素
- },
- },
- });
|