Use vue3-clipboard in LinkControl
This commit is contained in:
parent
a8ec660ffd
commit
b6f41a8241
@ -20,7 +20,7 @@
|
||||
import {Control, ControlOptions, DomUtil, Map} from 'leaflet';
|
||||
import {useStore} from "@/store";
|
||||
import '@/assets/icons/link.svg';
|
||||
import ClipboardJS from 'clipboard';
|
||||
import { toClipboard } from '@soerenmartius/vue3-clipboard'
|
||||
|
||||
export class LinkControl extends Control {
|
||||
// @ts-ignore
|
||||
@ -42,8 +42,9 @@ export class LinkControl extends Control {
|
||||
<use xlink:href="#link" />
|
||||
</svg>`;
|
||||
|
||||
new ClipboardJS(linkButton, {
|
||||
text: () => window.location.href.split("#")[0] + useStore().getters.url,
|
||||
linkButton.addEventListener('click', e => {
|
||||
e.preventDefault();
|
||||
toClipboard(window.location.href.split("#")[0] + useStore().getters.url);
|
||||
});
|
||||
|
||||
return linkButton;
|
||||
|
Loading…
Reference in New Issue
Block a user