Transpiled ES5 code to ES6/ES7

This commit is contained in:
Liyas Thomas
2020-06-11 19:55:40 +05:30
parent 9bc0ae975a
commit 0644a8c9fb
16 changed files with 108 additions and 123 deletions

View File

@@ -91,7 +91,7 @@ export default {
computed: {
availableLocales() {
return this.$i18n.locales.filter(i => i.code !== this.$i18n.locale)
return this.$i18n.locales.filter(({ code }) => code !== this.$i18n.locale)
},
},
}

View File

@@ -276,20 +276,20 @@ export default {
},
mounted() {
window.addEventListener("scroll", event => {
window.addEventListener("scroll", (event) => {
let mainNavLinks = document.querySelectorAll("nav ul li a")
let fromTop = window.scrollY
mainNavLinks.forEach(link => {
let section = document.querySelector(link.hash)
mainNavLinks.forEach(({ hash, classList }) => {
let section = document.querySelector(hash)
if (
section &&
section.offsetTop <= fromTop &&
section.offsetTop + section.offsetHeight > fromTop
) {
link.classList.add("current")
classList.add("current")
} else {
link.classList.remove("current")
classList.remove("current")
}
})
})