Accessing Javascript function in plugin from panel


In a field plugin for the panel I would like to add a link which should call a JS method from my plugin when clicked. This is my code:

panel.plugin('mshoestrng/exportstructure', {
  fields: {
    exportstructure: {
      methods: {
        openCSV() {
          w ='export.csv');
          w.document.write('hello world');
      template: `
        <div class="exportstructure">
          <a href="javascript:openCSV()">CSV herunterladen</a>

But I get this error.

Any idea how I can solve this?

<a href="javascript:panel.plugins.fields['k-exportstructure-field'].methods.openCSV()">CSV herunterladen</a>


But is this the “correct” Kirby way to do it?

<a @click="openCSV">CSV herunterladen</a>

Not so much a Kirby but a Vue.js way