vue2/examples/nested-props.html

56 lines
1.6 KiB
HTML
Raw Normal View History

<!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>
2013-08-20 01:09:06 +08:00
Seed.config({debug: true})
2013-08-20 01:32:58 +08:00
var data1 = {
c: 0,
b: {
c: 'zero'
}
},
data = {
c: 1,
b: {
c: 'one'
}
}
var Demo = Seed.ViewModel.extend({
2013-08-20 01:09:06 +08:00
init: function () {
2013-08-20 01:32:58 +08:00
this.msg = 'Yoyoyo'
this.a = data1
2013-08-20 01:09:06 +08:00
},
2013-08-16 09:41:02 +08:00
props: {
one: function () {
2013-08-20 01:32:58 +08:00
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
},
2013-08-20 01:32:58 +08:00
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>