案例:Vue.js案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<meta charset="utf-8">
5
<title>Vue 测试实例 - W3xue教程(w3xue.com)</title>
6
<script src="//unpkg.com/vue/dist/vue.js"></script>
7
</head>
8
<body>
9
<div id="app">
10
    <child message="hello!"></child>
11
</div>
12
13
<script>
14
// 注册
15
Vue.component('child', {
16
  // 声明 props
17
  props: ['message'],
18
  // 同样也可以在 vm 实例中像 “this.message” 这样使用
19
  template: '<span>{{ message }}</span>'
20
})
21
// 创建根实例
22
new Vue({
23
  el: '#app'
24
})
25
</script>
26
</body>
27
</html>