vue2/examples/nested_props.html

49 lines
1.4 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<title></title>
<meta charset="utf-8">
<script src="../dist/seed.js"></script>
</head>
<body sd-controller="test">
<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>
var Seed = require('seed')
Seed.controller('test', function (scope) {
// set the data any way you want.
scope.one = function () {
scope.a = {
c: 1,
b: {
c: 'one'
}
}
}
scope.two = function () {
scope.a.b = {
c: 'two'
}
scope.a.c = 2
}
scope.three = function () {
scope.a.b.c = 'three'
scope.a.c = 3
}
// computed properties also works!!!!
scope.d = {get: function () {
return (scope.a.b.c + scope.a.c) || ''
}}
})
var app = Seed.bootstrap()
</script>
</body>
</html>