| 1234567891011121314151617181920212223242526272829303132 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>Title</title>
- <script src="../vue.js"></script>
- </head>
- <body>
- <div id="app">
- <child content="hello world"></child>
- </div>
- <script>
- Vue.component('child',{
- 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({
- el: "#app"
- })
- </script>
- </body>
- </html>
|