小编Tom*_*más的帖子

反应谷歌身份服务

我一直在尝试在我的 React 应用程序中实现 Google 的身份服务 API,但无法让它工作。

我正在尝试实现以下非常简单的 JS 代码:https://developers.google.com/identity/gsi/web/guides/display-button#javascript

我想出的是以下内容:

  useEffect(() => {
    //I'm adding the <script>
    const elemScript = document.createElement('script'); 
    elemScript.src = "https://accounts.google.com/gsi/client";
    elemScript.async = true;
    elemScript.defer = true;
    document.body.append(elemScript);

    //adding the code from the documentation
    window.onload = function () {
      /*global google*/
      console.log(google)
      google.accounts.id.initialize({
        client_id: "<don't worry, I put the ID here>",
        callback: handleCredentialResponse
      });
      google.accounts.id.renderButton(
        googleButton.current, //this is a ref hook to the div in the official example
        { theme: "outline", size: "large" }  // customization …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs google-identity

8
推荐指数
2
解决办法
1万
查看次数

如何在 ubuntu 20.04 中安装编译器 g++-4.8.5

正如标题所说,我无法在当前的 ubuntu (20.04) 中安装该特定版本的 g++。

我一直在尝试通常的事情: sudo apt install g++- (并显示所有可能性,但只有 8 到 10 的版本)。同样发生在寻找 gcc 的可能性。

也试过这个:gist.github.com/application2000/73fd6f4bf1be6600a2cf9f56315a2d91(同样的问题)

在寻找了一段时间后,我放弃了我的研究并最终来到了这里。希望有比我更智慧的人可以帮我解决这个问题。

c++ ubuntu g++ ubuntu-20.04

6
推荐指数
1
解决办法
9388
查看次数

标签 统计

c++ ×1

g++ ×1

google-identity ×1

javascript ×1

reactjs ×1

ubuntu ×1

ubuntu-20.04 ×1