Answer the question
In order to leave comments, you need to log in
How to make an anchor in vue if the block is loaded after?
the task is to make a link when clicking on which the transition was to the desired comment www.url.url#/tickets/single/1302#comment_3257
how to make a simple anchor, I know, but so that it works after the comments are loaded?
Answer the question
In order to leave comments, you need to log in
export default {
data: () => ({
comments: [],
}),
methods: {
loadComments() {
this.comments = axios.get('...').then(response => response.data)
},
scrollToComment() {}
},
async mounted() {
await this.loadComments();
const commentId = this.$router.query.comment
// scrollToComment - ваша функция, которая скроллит до коммента
this.$nextTick(this.scrollToComment(commentId))
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question