Evan You 12 лет назад
Родитель
Сommit
3709862ec1
2 измененных файлов с 17 добавлено и 10 удалено
  1. 7 6
      examples/nested.html
  2. 10 4
      examples/simple.html

+ 7 - 6
examples/nested.html

@@ -12,16 +12,17 @@
 <body>
     <div sd-controller="Grandpa">
         <p sd-text="name"></p>
-
         <div sd-controller="Dad">
             <p><span sd-text="name"></span>, son of <span sd-text="^name"></span></p>
-
             <div sd-controller="Son">
-                <p><span sd-text="name"></span>, son of <span sd-text="^name"></span></p>
-
+                <p><span sd-text="name"></span>,son of <span sd-text="^name"></span></p>
                 <div sd-controller="Baby">
-                    <p><span sd-text="name"></span>, son of <span sd-text="^name"></span>, grandson of <span sd-text="^^name"></span> and great-grandson of <span sd-text="$name"></span></p>
-
+                    <p>
+                        <span sd-text="name"></span>,
+                        son of <span sd-text="^name"></span>,
+                        grandson of <span sd-text="^^name"></span>
+                        and great-grandson of <span sd-text="$name"></span>
+                    </p>
                 </div>
             </div>
         </div>

+ 10 - 4
examples/simple.html

@@ -3,17 +3,23 @@
     <head>
         <title>Simple Example</title>
         <meta charset="utf-8">
+        <style type="text/css">
+            .red { color: red; }
+        </style>
         <script src="../dist/seed.js"></script>
     </head>
     <body sd-controller="hello">
-        <input type="checkbox" sd-checked="ok" checked>
-        <span sd-text="hello" sd-style="text-transform:format" sd-if="ok"></span>
+        <input type="checkbox" sd-checked="checked">
+        <span sd-text="hello | uppercase" sd-class="red:checked"></span>
         <script>
             var Seed = require('seed')
+
             Seed.controller('hello', function (scope) {
-                scope.hello = 'Hello World!'
-                scope.format = 'uppercase'
+                scope.hello = {get:function () {
+                    return scope.checked ? 'red!!!' : 'hello seed'
+                }}
             })
+
             Seed.bootstrap()
         </script>
     </body>