forked from RubyLouvre/avalon
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
qincheng
committed
Sep 8, 2014
1 parent
da95420
commit 0f7784d
Showing
2 changed files
with
68 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width"> | ||
<script src="../avalon.js" ></script> | ||
<script> | ||
var model = avalon.define({ | ||
$id: "test", | ||
aaa: "2", | ||
bbb: "2", | ||
$ccc: "1", | ||
ddd: "1", | ||
$skipArray: ["ddd"], | ||
click: function(a) { | ||
model[a] = new Date - 0 | ||
} | ||
}) | ||
model.$watch("aaa", function(a, b) { | ||
console.log("aaa", a, b) | ||
}) | ||
model.$watch("bbb", function(a, b) { | ||
console.log("bbb", a, b) | ||
}) | ||
model.$watch("$ccc", function(a, b) { | ||
console.log("$ccc", a, b) | ||
}) | ||
model.$watch("ddd", function(a, b) { | ||
console.log("ddd", a, b) | ||
}) | ||
</script> | ||
<style> | ||
.ms-hover div:hover{ | ||
background:yellowgreen; | ||
} | ||
</style> | ||
</head> | ||
<body ms-controller="test" class='ms-hover'> | ||
<div ms-click="click('aaa')">{{aaa}}</div> | ||
<div ms-click="click('bbb')">{{bbb}}</div> | ||
<div ms-click="click('$ccc')">{{$ccc}}</div> | ||
<div ms-click="click('ddd')">{{ddd}}</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,37 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>avalon入门</title> | ||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | ||
<script src="avalon.js" ></script> | ||
<title>ms-attr-*</title> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width"> | ||
<script src="avalon.js"></script> | ||
|
||
<script> | ||
var model = avalon.define({ | ||
$id: "test", | ||
array: [{a: 222}, {a: 333}], | ||
"aaa-eee": "ddd", | ||
aaa: "bbb ddd" | ||
avalon.define("aaa", function(vm) { | ||
vm.e = "true" | ||
|
||
}) | ||
model.$watch("aaa-eee", function(e){ | ||
alert(e) | ||
avalon.define("bbb", function(vm) { | ||
vm.e = "false" | ||
|
||
}) | ||
setTimeout(function() { | ||
model.array.set(1, {a: 444}) | ||
// model.$fire("aaa-eee", "oooo") | ||
}, 2000) | ||
|
||
</script> | ||
<style> | ||
|
||
.bbb{ | ||
background:pink; | ||
.active { | ||
background: goldenrod; | ||
} | ||
.ddd{ | ||
border: 1px solid green; | ||
.readonly{ | ||
border:1px solid blueviolet; | ||
} | ||
|
||
</style> | ||
|
||
</head> | ||
<body ms-controller="test" ms-class="{{aaa}}"> | ||
<div > | ||
<ul> | ||
<li ms-repeat="array">{{el.a}}</li> | ||
</ul> | ||
</div> | ||
<body> | ||
<form method="get" action="aaa.html" ms-controller="bbb"> | ||
<div ms-controller="aaa"> | ||
<div ms-class="{{e}}111">11111 | ||
</div> | ||
</div> | ||
</form> | ||
</body> | ||
</html> | ||
</html> |