diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2017-09-15 16:10:08 +0300 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2017-09-19 19:55:25 +0300 |
commit | 13c86bb4ad7a858799440002fa3451e3513167a9 (patch) | |
tree | 283bbe5fd2e94fa8f1edd36911f97c2bc290d3fd /app/assets/javascripts/vue_shared/components/clipboard_button.vue | |
parent | cd61d6e6904547c709a78b8404077bab2abfa92a (diff) |
Init store for registry
Diffstat (limited to 'app/assets/javascripts/vue_shared/components/clipboard_button.vue')
-rw-r--r-- | app/assets/javascripts/vue_shared/components/clipboard_button.vue | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/app/assets/javascripts/vue_shared/components/clipboard_button.vue b/app/assets/javascripts/vue_shared/components/clipboard_button.vue new file mode 100644 index 00000000000..ebb3dbd0112 --- /dev/null +++ b/app/assets/javascripts/vue_shared/components/clipboard_button.vue @@ -0,0 +1,40 @@ + +import Clipboard from 'vendor/clipboard'; + +<script> + export default { + name: 'clipboardButton', + props: { + text: { + type: String, + required: true, + }, + title: { + type: String, + required: true, + }, + }, + mounted() { + return new Clipboard(this.$refs.btn, { + text: () => { + return this.text; + }, + }); + } + }; +</script> + +<template> + <button + type="button" + class="btn btn-transparent btn-clipboard" + :data-title="title" + :data-clipboard-text="text" + ref="btn" + > + <i + aria-hidden="true" + class="fa fa-clipboard"> + </i> + </button> +</template> |