diff --git a/src/mip-bind/README.md b/src/mip-bind/README.md
index e9891b622..b6f54cb2b 100644
--- a/src/mip-bind/README.md
+++ b/src/mip-bind/README.md
@@ -20,9 +20,14 @@ mip-bind 数据驱动组件,可以允许开发者在页面中动态操作数
}
-
+
+
+
```
## 属性
-## 注意事项
+其中 mip-data 为绑定数据的组件,属性如下:
+
+### src
+用于通过异步请求获取数据
\ No newline at end of file
diff --git a/src/mip-bind/mip-bind.js b/src/mip-bind/mip-bind.js
index 6a5a41a5a..d1f14dc1a 100644
--- a/src/mip-bind/mip-bind.js
+++ b/src/mip-bind/mip-bind.js
@@ -25,11 +25,13 @@ define(function (require) {
this._compile = new Compile();
this._observer = new Observer();
this._bindEvent();
- MIP.setData = function (data) {
- me._bindTarget(false, data);
+ // from=0 called by html attributes
+ // from=1 refers the method called by mip.js
+ MIP.setData = function (action, from) {
+ me._bindTarget(false, action, from);
};
- MIP.$set = function (data) {
- me._bindTarget(true, data);
+ MIP.$set = function (action, from) {
+ me._bindTarget(true, action, from);
}
};
@@ -37,11 +39,13 @@ define(function (require) {
* Bind target
*
*/
- Bind.prototype._bindTarget = function (compile, data) {
- if (typeof data === "string") {
- data = (new Function('return ' + data))();
+ Bind.prototype._bindTarget = function (compile, action, from) {
+ var data = from ? action.arg : action;
+ var evt = from ? action.event.target: {};
+ if (typeof data === 'string') {
+ data = (new Function('DOM', 'return ' + data))(evt);
}
- if (typeof data === "object") {
+ if (typeof data === 'object') {
fn.extend(window.m, data);
if (compile) {
this._observer.start(this._win.m);
diff --git a/src/mip-bind/mip-compile.js b/src/mip-bind/mip-compile.js
index c8b2466f6..9ef0440d5 100644
--- a/src/mip-bind/mip-compile.js
+++ b/src/mip-bind/mip-compile.js
@@ -171,7 +171,6 @@ define(function (require) {
node.removeAttribute(attrName);
}
catch (e) {
- console.warn(e);
}
return value;
};
diff --git a/src/mip-bind/mip-watcher.js b/src/mip-bind/mip-watcher.js
index 1e58c7481..3fd8bc303 100644
--- a/src/mip-bind/mip-watcher.js
+++ b/src/mip-bind/mip-watcher.js
@@ -46,7 +46,6 @@ define(function (require) {
+ 'try {'
+ 'return ' + exp
+ '} catch (e) {'
- + 'console.warn(e)'
+ '}'
+ '}'
));