forked from webcore-it/nuxt-clipboard2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ab13cb0
commit 48abfb8
Showing
6 changed files
with
87 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,22 @@ | ||
.DS_Store | ||
|
||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
# Editor directories and files | ||
.idea | ||
*.iml | ||
.vscode | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# TypeScript v1 declaration files | ||
typings/ | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
|
||
# next.js build output | ||
.next |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,40 @@ | ||
# nuxt-clipboard2 | ||
Nuxt module for vue-clipboard2 | ||
|
||
> A "copy to clipboard" module for Nuxt.js using [vue-clipboard2](https://github.com/Inndy/vue-clipboard2) | ||
## Setup | ||
- Add `nuxt-clipboard2` dependency using yarn or npm to your project | ||
- Add `nuxt-clipboard2` to `modules` section of `nuxt.config.js` | ||
|
||
```js | ||
{ | ||
modules: [ | ||
'nuxt-clipboard2', | ||
] | ||
} | ||
``` | ||
|
||
## Usage | ||
You can use **$copyText** in almost any context using `app.$copyText` or `this.$copyText` (Including store actions). | ||
|
||
See [vue-clipboard2 official docs](https://github.com/Inndy/vue-clipboard2) for more usage information. | ||
|
||
```js | ||
export default { | ||
methods: { | ||
async copySomething(text) { | ||
try { | ||
await this.$copyText(text); | ||
} catch (e) { | ||
console.error(e); | ||
} | ||
}, | ||
}, | ||
}; | ||
``` | ||
|
||
## License | ||
|
||
[MIT License](./LICENSE) | ||
|
||
Copyright (c) webcore-it |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const path = require('path'); | ||
|
||
module.exports = function nuxtClipboard(moduleOptions) { | ||
const options = Object.assign({}, this.options.toast, moduleOptions); | ||
|
||
// Register plugin | ||
this.addPlugin({ | ||
src: path.resolve(__dirname, 'plugin.js'), | ||
ssr: false, | ||
fileName: 'clipboard.js', | ||
options, | ||
}); | ||
}; | ||
|
||
module.exports.meta = require('./package.json'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "nuxt-clipboard2", | ||
"version": "0.0.1", | ||
"license": "MIT", | ||
"main": "index.js", | ||
"repository": "https://github.com/webcore-it/nuxt-clipboard2", | ||
"homepage": "https://github.com/webcore-it/nuxt-clipboard2", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"dependencies": { | ||
"vue-clipboard2": "^0.1.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import Vue from 'vue'; | ||
import VueClipboard from 'vue-clipboard2'; | ||
|
||
Vue.use(VueClipboard); | ||
|
||
export default function (ctx, inject) { | ||
inject('copyText', Vue.copyText); | ||
} |