Comparing version 2.0.11 to 2.0.12
@@ -294,3 +294,3 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
'use strict'; | ||
var EventEmitter, Template, addEvent, diff, each, extend, isArray, isFunction, nextTick, nodeContains, objectKeys, patch, ref, removeEvent, | ||
var EventEmitter, Template, addEvent, diff, each, extend, isArray, isFunction, isPlainObject, nextTick, nodeContains, objectKeys, patch, ref, removeEvent, | ||
extend1 = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
@@ -302,3 +302,3 @@ hasProp = {}.hasOwnProperty, | ||
ref = __webpack_require__(6), extend = ref.extend, nextTick = ref.nextTick, each = ref.each, isFunction = ref.isFunction, isArray = ref.isArray, objectKeys = ref.objectKeys, addEvent = ref.addEvent, removeEvent = ref.removeEvent, nodeContains = ref.nodeContains; | ||
ref = __webpack_require__(6), extend = ref.extend, nextTick = ref.nextTick, each = ref.each, isFunction = ref.isFunction, isArray = ref.isArray, isPlainObject = ref.isPlainObject, objectKeys = ref.objectKeys, addEvent = ref.addEvent, removeEvent = ref.removeEvent, nodeContains = ref.nodeContains; | ||
@@ -418,2 +418,26 @@ diff = __webpack_require__(7); | ||
/* | ||
## 取值 | ||
```coffee | ||
list = tpl.get 'list' | ||
``` | ||
*/ | ||
Template.prototype.get = function(key, defaultVal) { | ||
if (defaultVal == null) { | ||
defaultVal = null; | ||
} | ||
if (this.scope.hasOwnProperty(key)) { | ||
if (isPlainObject(this.scope[key])) { | ||
return extend(true, {}, this.scope[key]); | ||
} else if (isArray(this.scope[key])) { | ||
return extend(true, [], this.scope[key]); | ||
} else { | ||
return this.scope[key]; | ||
} | ||
} | ||
return defaultVal; | ||
}; | ||
/* | ||
## 删除 scope 的 key | ||
@@ -444,20 +468,2 @@ ```coffee | ||
/* | ||
## 取值 | ||
```coffee | ||
list = tpl.get 'list' | ||
``` | ||
*/ | ||
Template.prototype.get = function(key, defaultVal) { | ||
if (defaultVal == null) { | ||
defaultVal = null; | ||
} | ||
if (this.scope.hasOwnProperty(key)) { | ||
return this.scope[key]; | ||
} | ||
return defaultVal; | ||
}; | ||
/* | ||
## 销毁实例 | ||
@@ -464,0 +470,0 @@ 已经插入 DOM Tree 的,会被移除 |
{ | ||
"name": "mcoreapp", | ||
"version": "2.0.11", | ||
"version": "2.0.12", | ||
"description": "simple MVVM", | ||
@@ -5,0 +5,0 @@ "main": "dist/mcoreApp.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11457
847055
67