let hasclass=function hasClass(element, cls) { return (' ' + element.className + ' ').indexOf(' ' + cls + ' ') > -1; }; let language=window.localStorage.getItem("language"); switch(language){ case "en": break; case "cn": default:language="cn"; } for(var ele of document.getElementsByClassName("translate")){ ele.innerText=ele.getAttribute('data-'+language);
}
window.localStorage.setItem("language","cn") window.location.reload()网页好使,不适合vue