Accessing Javascript function in plugin from panel

Hi!

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 = window.open('export.csv');
          w.document.write('hello world');
          w.document.close();
        }
      },
      template: `
        <div class="exportstructure">
          <a href="javascript:openCSV()">CSV herunterladen</a>
        </div>
      `
    }
  }
});

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>

works!

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