「Javascript/vue/helloworld」の版間の差分
提供: 初心者エンジニアの簡易メモ
(→サンプル) |
|||
| 行23: | 行23: | ||
</html> | </html> | ||
</pre> | </pre> | ||
| + | |||
| + | {{text}} or <span v-text="text"></span> で表示する | ||
helloworld.js | helloworld.js | ||
2018年4月13日 (金) 17:34時点における版
vueのscriptロード
本番用
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js"></script>
デバッグ用
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.min.js"></script>
サンプル
helloworld.html
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<script src="https://unpkg.com/vue@2.4.4/dist/vue.min.js"></script>
</head>
<body>
<div id="column1">
<p>{{text}}</p>
<p><span v-text="text"></span></p>
</div>
<script src="helloworld.js"></script>
</body>
</html>
テンプレート:Text or で表示する
helloworld.js
new Vue({
el: '#column1',
data: {
text: 'ほげほげ'
}
});
