Yi 3 years ago
parent
commit
23d77b7f76
1 changed files with 12 additions and 2 deletions
  1. 12 2
      demo/4-3/index.html

+ 12 - 2
demo/4-3/index.html

@@ -7,11 +7,21 @@
 </head>
 <body>
   <div id="app">
-    <child></child>
+    <child content="hello world"></child>
   </div>
   <script>
     Vue.component('child',{
-      template: '<div>Child</div>'
+      props: {
+        content: {
+          type: [String,Number],
+          required: false,
+          default: "default value",
+          validator: function(value){
+            return (value.length > 5)
+          }
+        }
+      },
+      template: '<div>{{content}}</div>'
     })
 
     var vm = new Vue({