Vue.jsでHello Worldを実装するサンプル

2022年1月30日

環境
Windows 10 64bit
@vue/cli 4.5.15

使用例

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<!DOCTYPE html>
<html>
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
<body>
<div id="app">
<h1>{{ msg }}</h1>
</div>
<script>
var myObject = new Vue({
el: '#app',
data: {msg: 'Study Vue Become smart!'}
})
</script>
</body>
</html>
<!DOCTYPE html> <html> <script src="https://cdn.jsdelivr.net/npm/vue"></script> <body> <div id="app"> <h1>{{ msg }}</h1> </div> <script> var myObject = new Vue({ el: '#app', data: {msg: 'Study Vue Become smart!'} }) </script> </body> </html>
<!DOCTYPE html>
<html>
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
<body>

<div id="app">
  <h1>{{ msg }}</h1>
</div>

<script>
var myObject = new Vue({
  el: '#app',
  data: {msg: 'Study Vue Become smart!'}
})
</script>

</body>
</html>

実行結果
存したファイルをブラウザで開いて確認すると「Study Vue Become smart!」が表示される

Vue.js

Posted by arkgame