path: '/n/:id'
button(@click="$router.push('/n/1')" )
mounted () {
const idModal = this.$router.currentRoute.params.id
if (idModal) {
this.openModalById(idModal )
}
}
header nav ul li ul {
background: #f7f7f7;
}
function getFile(url) {
return new Promise((resolve, reject) => {
const xhr = new XMLHttpRequest();
xhr.open("GET", url);
xhr.onreadystatechange = () => resolve(xhr.responseText);
xhr.onerror = () => reject(xhr.statusText);
xhr.send();
});
}
getFile(url).then((res) => {
console.log(res);
});
npm i
без подчеркиванияconst anchors = document.querySelectorAll('a[href*="#"]')
anchors.forEach((anchor) => {
anchor.addEventListener('click', function (e) {
e.preventDefault()
const blockID = anchor.getAttribute('href').substr(1)
document.getElementById(blockID).scrollIntoView({
behavior: 'smooth',
block: 'start'
})
})
})