vue-clickaway icon indicating copy to clipboard operation
vue-clickaway copied to clipboard

There is any way to use it globally..?

Open ShekhSaifuddin007 opened this issue 3 years ago • 3 comments

Where have a dropdown or something like that we need this, my question is can we use this globally.? that's why we don't need to import this in every component.

ShekhSaifuddin007 avatar Jan 29 '21 19:01 ShekhSaifuddin007

I'm also interested in this.

florian-lefebvre avatar Jan 29 '21 20:01 florian-lefebvre

In main.js, simply do

Vue.mixin({
  mixins: [ clickaway ]
})

Anything you define inside Vue.mixin, is globally available, that be data, methods, computed or more mixins.

fjeddy avatar Feb 21 '21 04:02 fjeddy

Using in component template should be defined in directives:

Vue.component('iam-select', {
		directives: {
			onClickaway: VueClickaway.directive,
		},

and html-file should have <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue-clickaway.min.js"></script>

viT-1 avatar Sep 29 '21 12:09 viT-1