utterance / utterances

:crystal_ball: A lightweight comments widget built on GitHub issues
https://utteranc.es
MIT License
8.66k stars 567 forks source link

how to reload utterance comment when title change #630

Open toughhyeok opened 1 year ago

toughhyeok commented 1 year ago

hello. I'm using Vue.js to dynamically change document.title. When document.title is changed, how can I automatically reload to the issue that matches the title?

...
mounted() {
  console.log("mounted()...");
  let script = document.createElement("script");
  script.setAttribute("src", "https://utteranc.es/client.js");
  script.setAttribute("issue-term", "title");
  script.setAttribute("repo", $repo);
  script.setAttribute("theme", "github-light");
  script.setAttribute("crossorigin", "anonymous");
  script.setAttribute("async", true);
  const element = document.getElementById("utte-comment");
  element.appendChild(script);
},
...

...
axios.get(`/api/post/${postId}/`)
  .then(res => {
    console.log("FETCH POSTDETAIL GET RES", res);
    this.post = res.data.post;
    this.prevPost = res.data.prevPost;
    this.nextPost = res.data.nextPost;
    document.title = this.post.title;
  })
...