Getting started with Vue: the first program

The easiest way to try Vue.js is to use the Hello World example. Then introduce Vue in the following way:


Get started

For prototyping or learning, you can use the latest version like this:

<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>

For production environments, we recommend linking to a clear version number and build file to avoid unexpected damage caused by the new version:

<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>

If you use native ES Modules, there is also a build file compatible with ES Modules:

<script type="module">
  import Vue from 'https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.esm.browser.js'
</script>

Declarative rendering

.html

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

.js

var app = new Vue({
    
    
  el: '#app',
  data: {
    
    
    message: 'Hello Vue!'
  }
})

run

Insert picture description here

Guess you like

Origin blog.csdn.net/qq_43522998/article/details/109604645