Nuxt adds sharing to it, and the share button does not display.

  mounted(){
   this.bbb();
  }
methods:{
  bbb(){
      var self = this;
      window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"", onBeforeClick:SetShareUrl, "bdUrl" : "http://www.applicationuk.com/cn/youziDetail", "bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"0","bdSize":"16"},"share":{},"image":{"viewList":["qzone","sqq","weixin","tsina"],"viewText":":","viewSize":"16"},"selectShare":{"bdContainerClass":null,"bdSelectMiniList":["qzone","sqq","weixin","tsina"]}};
      const s = document.createElement("script");
      s.type = "text/javascript";
      s.src = "http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion=" + ~(-new Date() / 36e5);
      document.body.appendChild(s)
      function SetShareUrl(cmd, config) {
        config.bdUrl = "http://www.applicationuk.com/cn/youziDetail?id="+ self.ppp;
        return config;
      }
    }
  }

when you click on the page, the share button is not displayed, but sometimes it will be displayed when you press f5. What"s going on? Then it is right to write the js directly in the dom on the interface.

Dec.09,2021

should not be called in mounted, it should only be called after dom, and data are rendered, otherwise, the interface only loads dom. The acquired data has not been loaded yet. Should be called after the data is loaded.

Menu