Answers for "create anchor tag in vue js"

1

vue add script tags and link tags

created() {
	let doc = document.createElement('script');  
	doc.setAttribute('src',"your-link-here");
	document.head.appendChild(doc);
}
Posted by: Guest on March-16-2021
0

vue on page link or anchor

// uses example; scrollToElement(this.$route.hash)
// uses example; scrollToElement('#cafe-menu')


scrollToElement (id) {
  // takes input id with hash
  // eg. #cafe-menu
  const el = document.querySelector(id)
  el && el.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "nearest" })

}
Posted by: Guest on June-01-2021

Browse Popular Code Answers by Language