2017-09-03 94 views
0

我想要正确呈现“重新加载”github按钮,当我按另一个按钮时。我搜索,我得到this information,但我不能这样做,我面临的另一个错误:呈现github叉子按钮

Uncaught Error: Module name "github-buttons" has not been loaded yet for context: _. Use require([]).

当我包括http://requirejs.org/docs/release/2.2.0/minified/require.js

+0

你正在使用什么框架/库?即:角度,反应或vue? – Microsmsm

+0

纯JavaScript,但我最近包括require.js并且不起作用。 @Microsmsm –

回答

0

Node.JS is a server-side technology, not a browser technology. Thus, Node-specific calls, like require(), do not work in the browser.

See browserify or webpack if you wish to serve browser-specific modules from Node.

但是你可以使用,以使得该按钮的步骤...

Usage:

  1. Place this tag where you want the button to render
<a class="github-button" href="https://github.com/microsmsm" data- 
size="large" aria-label="Follow @microsmsm on GitHub">Follow 
@microsmsm</a> 
  1. Place this tag in your head or just before your close body tag
<script async defer src="https://buttons.github.io/buttons.js"></script> 

代码示例

https://codepen.io/Microsmsm/pen/NvJaNm?editors=1100

参考

https://buttons.github.io/

+0

好的。制作一个按钮,在你每次点击它时创建这个github按钮,并且你有错误! –

+0

你要求的是在这里提供: https://buttons.github.io/ – Microsmsm

+0

当你点击'点击'按钮时,检查此https://codepen.io/zeyadetman/pen/ZJPXxB叉按钮不会出现在风格,只是一个元素。 @Microsmsm –