File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -36,34 +36,48 @@ Using npm:
36
36
``` bash
37
37
$ npm install axios
38
38
```
39
+ <button onclick =" copyToClipboard (' npm install axios' )" >Copy</button >
39
40
40
41
Using bower:
41
42
42
43
``` bash
43
44
$ bower install axios
44
45
```
45
-
46
+ < button onclick = " copyToClipboard ( ' bower install axios ' ) " >Copy</ button >
46
47
Using yarn:
47
48
48
49
``` bash
49
50
$ yarn add axios
50
51
```
51
-
52
+ < button onclick = " copyToClipboard ( ' yarn add axios ' ) " >Copy</ button >
52
53
Using jsDelivr CDN:
53
54
54
55
``` html
55
56
<script src =" https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js" ></script >
56
57
```
58
+ <button onclick="copyToClipboard('<script src =" https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js " ></script >')">Copy</button >
57
59
58
60
Using unpkg CDN:
59
61
60
62
``` html
61
63
<script src =" https://unpkg.com/axios/dist/axios.min.js" ></script >
62
64
```
63
-
65
+ <button onclick="copyToClipboard('< script src = " https://unpkg.com/axios/dist/axios.min.js " ></ script >')">Copy</ button >
64
66
Prebuilt CommonJS modules for direct importing with require (if your module bundler failed to resolve them automatically)
65
67
66
68
``` js
67
69
const axios = require (' axios/dist/browser/axios.cjs' ); // browser
68
70
const axios = require (' axios/dist/node/axios.cjs' ); // node
69
71
```
72
+ <button onclick="copyToClipboard('const axios = require('axios/dist/browser/axios.cjs');
73
+ const axios = require(\' axios/dist/node/axios.cjs\' ); // node')">Copy</button >
74
+
75
+ <script >
76
+ function copyToClipboard (text ) {
77
+ navigator .clipboard .writeText (text).then (() => {
78
+ alert (' Copied to clipboard!' );
79
+ }).catch (err => {
80
+ console .error (' Failed to copy: ' , err);
81
+ });
82
+ }
83
+ </script >
You can’t perform that action at this time.
0 commit comments