Using vue js via NPM in Statamic 3 templates

Hey fellows,

I wanna use vue js in, let's say, a partial (or in a view, whatever) without using a CDN but with npm. I tested out a bit but nothing worked. Example nav.antlers.html (not working):

I had to remove the script tag because syntax highlighting didn't work for this tag

<nav id="main-nav">
  @{{ msg }}
  <!-- Naughty nav stuff -->
</nav>

<!-- opening script tag -->
import Vue from 'vue'

const MainNavigation = {
  data() {
    return {
      msg: "hello"
    }
  }
}

Vue.createApp(MainNavigation).mount('#main-nav')
<!-- closing script tag -->

What's the correct approach to use vue in the template without fetching it via a CDN?

Answered by Max Glass!
>>>>>>> Answered <<<<<<<
4 Replies
2 Followers