Vue 的一些笔记

2021/3/29 Vue

# 引入

CDN 引入

# Vue2实例

<script src="https://unpkg.com/vue/dist/vue.js"></script>
1
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Vue 测试实例</title>
<script src="https://unpkg.com/vue/dist/vue.js"></script>
</head>
<body>
<div id="app">
  <p>{{ message }}</p>
</div>

<script>
new Vue({
  el: '#app',
  data: {
    message: 'Hello Vue.js!'
  }
})
</script>
</body>
</html>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

# Vue3实例

<script src="https://unpkg.com/vue@next"></script>
1
  <!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
      
  </div>
  <script src="https://unpkg.com/vue@next"></script>
  <script>
    const okarin = {
      template:'<h2>HelloWorld</h2>'
    }
    const app = Vue.createApp(okarin);
    app.mount("#app")
  </script>
</body>
</html>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Last Updated: 2022/12/12下午11:51:23