| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <title></title>
- <meta charset="utf-8">
- <script src="../dist/seed.js"></script>
- </head>
- <body>
- <h1>a.b.c : {{a.b.c}}</h1>
- <h2>a.c : {{a.c}}</h2>
- <h3>Computed property that concats the two: {{d}}</h3>
- <button sd-on="click:one">one</button>
- <button sd-on="click:two">two</button>
- <button sd-on="click:three">three</button>
- <script>
- Seed.config({debug: true})
- var data1 = {
- c: 0,
- b: {
- c: 'zero'
- }
- },
- data = {
- c: 1,
- b: {
- c: 'one'
- }
- }
- var Demo = Seed.ViewModel.extend({
- init: function () {
- this.msg = 'Yoyoyo'
- this.a = data1
- },
- props: {
- one: function () {
- this.a = data
- },
- two: function () {
- this.a.b = {
- c: 'two'
- }
- this.a.c = 2
- },
- three: function () {
- this.a.b.c = 'three'
- this.a.c = 3
- },
- d: {get: function (ctx) {
- return (ctx.vm.msg + this.a.b.c + this.a.c) || ''
- }}
- }
- })
- var app = new Demo({ el: document.body })
- </script>
- </body>
- </html>
|