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:
3636``` bash
3737$ npm install axios
3838```
39+ <button onclick =" copyToClipboard (' npm install axios' )" >Copy</button >
3940
4041Using bower:
4142
4243``` bash
4344$ bower install axios
4445```
45-
46+ < button onclick = " copyToClipboard ( ' bower install axios ' ) " >Copy</ button >
4647Using yarn:
4748
4849``` bash
4950$ yarn add axios
5051```
51-
52+ < button onclick = " copyToClipboard ( ' yarn add axios ' ) " >Copy</ button >
5253Using jsDelivr CDN:
5354
5455``` html
5556<script src =" https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js" ></script >
5657```
58+ <button onclick="copyToClipboard('<script src =" https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js " ></script >')">Copy</button >
5759
5860Using unpkg CDN:
5961
6062``` html
6163<script src =" https://unpkg.com/axios/dist/axios.min.js" ></script >
6264```
63-
65+ <button onclick="copyToClipboard('< script src = " https://unpkg.com/axios/dist/axios.min.js " ></ script >')">Copy</ button >
6466Prebuilt CommonJS modules for direct importing with require (if your module bundler failed to resolve them automatically)
6567
6668``` js
6769const axios = require (' axios/dist/browser/axios.cjs' ); // browser
6870const axios = require (' axios/dist/node/axios.cjs' ); // node
6971```
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