forked from fanruan/fineui
Browse Source
Merge in VISUAL/fineui from ~GUY/fineui:master to master * commit '2ee97f0291aa3d19b9e35c656706322f433baa56': 支持自动watches6
guy
3 years ago
48 changed files with 255 additions and 287 deletions
@ -0,0 +1,57 @@
|
||||
<html> |
||||
<head> |
||||
<meta charset="utf-8"> |
||||
<title></title> |
||||
<link rel="stylesheet" type="text/css" href="../dist/2.0/fineui.css"/> |
||||
<script src="../dist/2.0/fineui.js"></script> |
||||
</head> |
||||
<body> |
||||
<div id="wrapper"></div> |
||||
<script> |
||||
var Model = BI.inherit(Fix.Model, { |
||||
state: function () { |
||||
return { |
||||
count: 0 |
||||
}; |
||||
} |
||||
}); |
||||
|
||||
BI.model("demo.model", Model); |
||||
|
||||
var Widget = BI.inherit(BI.Widget, { |
||||
_store: function () { |
||||
return BI.Models.getModel("demo.model"); |
||||
}, |
||||
setup: function () { |
||||
var store = BI.useStore(); |
||||
return function () { |
||||
return { |
||||
type: "bi.vertical", |
||||
items: [{ |
||||
type: "bi.button", |
||||
effect: function () { |
||||
this.setText(store.model.count) |
||||
}, |
||||
handler: function () { |
||||
store.model.count++; |
||||
} |
||||
}] |
||||
}; |
||||
}; |
||||
} |
||||
}); |
||||
BI.shortcut("demo.hooks", Widget); |
||||
BI.createWidget({ |
||||
type: "bi.absolute", |
||||
items: [{ |
||||
el: { |
||||
type: "demo.hooks" |
||||
}, |
||||
top: 100, |
||||
left: 100 |
||||
}], |
||||
element: "#wrapper" |
||||
}); |
||||
</script> |
||||
</body> |
||||
</html> |
@ -0,0 +1,66 @@
|
||||
<html> |
||||
<head> |
||||
<meta charset="utf-8"> |
||||
<title></title> |
||||
<link rel="stylesheet" type="text/css" href="../dist/2.0/fineui.css"/> |
||||
<script src="../dist/2.0/fineui.js"></script> |
||||
</head> |
||||
<body> |
||||
<div id="wrapper"></div> |
||||
<script> |
||||
var Model = BI.inherit(Fix.Model, { |
||||
state: function () { |
||||
return { |
||||
cls: "my-cls", |
||||
background: "red", |
||||
count: 0 |
||||
}; |
||||
} |
||||
}); |
||||
|
||||
BI.model("demo.model", Model); |
||||
|
||||
var Widget = BI.inherit(BI.Widget, { |
||||
_store: function () { |
||||
return BI.Models.getModel("demo.model"); |
||||
}, |
||||
setup: function () { |
||||
var store = BI.useStore(); |
||||
return function () { |
||||
return { |
||||
type: "bi.vertical", |
||||
items: [{ |
||||
type: "bi.button", |
||||
cls: function () { |
||||
return store.model.cls; |
||||
}, |
||||
css: function () { |
||||
return { |
||||
background: store.model.background |
||||
} |
||||
}, |
||||
text: "按钮", |
||||
handler: function () { |
||||
store.model.cls = "my-cls" + store.model.count++; |
||||
store.model.background = "blue"; |
||||
} |
||||
}] |
||||
}; |
||||
}; |
||||
} |
||||
}); |
||||
BI.shortcut("demo.hooks", Widget); |
||||
BI.createWidget({ |
||||
type: "bi.absolute", |
||||
items: [{ |
||||
el: { |
||||
type: "demo.hooks" |
||||
}, |
||||
top: 100, |
||||
left: 100 |
||||
}], |
||||
element: "#wrapper" |
||||
}); |
||||
</script> |
||||
</body> |
||||
</html> |
Loading…
Reference in new issue