Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Hello World using Vue with CDN

In this series we are going to load Vue from a fixed place. We are using a CDN, but you could also download Vue and serve it from your own web-site. The main point is that this way of using Vue does NOT require a build step.

In the first example we create a simple variable and display its content.

<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>

<div id="app">{{ message }}</div>

<script>
  const { createApp, ref } = Vue

  createApp({
    setup() {
      const message = ref('Hello vue!')
      return {
        message
      }
    }
  }).mount('#app')
</script>