公式

https://vuejs.org/

日本語もあるよ、でも頑張って英語で読もう!

テンプレ

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <!-- vue cdn -->
	<script src="<https://cdn.jsdelivr.net/npm/vue/dist/vue.js>"></script>
</body>
</html>

最小構成

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    {{ message }} / {{ name }}
  </div>
  <!-- vue cdn -->
  <script src="<https://cdn.jsdelivr.net/npm/vue/dist/vue.js>"></script>
  <script>
    var app = new Vue({
      el: '#app',
      data: {
        message: 'Hello Vue!',
				name: '松田信介'
      },
			methods: {
        hello: function() {
          alert("hello")
        },
        hoge: function() {
          alert("hoge")
        }
      }
    })
  </script>
</body>
</html>
// consoleで試してみよう
app.hello()

Veu が DOM操作をいい感じにやってくれる

データバインディング

イベントの色々な登録のやり方

// 普通のjsからvueオブジェクトのメソッドを呼び出す
<button onclick="app.hello()">押してね</button>

// vueの書き方
<button v-on:click="hello">押してね</button>
<button @click="hello">押してね</button>

通信ライブラリ Axios

https://github.com/axios/axios