fix: function default value

This commit is contained in:
tangjinzhou 2020-06-07 09:24:44 +08:00
parent 0935262334
commit 8d2d659d6f
2 changed files with 4 additions and 2 deletions

View File

@ -81,8 +81,10 @@ export const withDefault = function(type) {
warn(`${this._vueTypes_name} - invalid default value: "${def}"`, def);
return this;
}
// isFunction(def) 关注 https://github.com/vuejs/vue-next/pull/1291 合并发版本后可删除
this.default =
isArray(def) || isPlainObject(def)
isArray(def) || isPlainObject(def) || isFunction(def)
? function() {
return def;
}

View File

@ -31,7 +31,7 @@ const AffixProps = {
/** 固定状态改变时触发的回调函数 */
// onChange?: (affixed?: boolean) => void;
/** 设置 Affix 需要监听其滚动事件的元素,值为一个返回对应 DOM 元素的函数 */
target: PropTypes.func.def(() => getDefaultTarget),
target: PropTypes.func.def(getDefaultTarget),
prefixCls: PropTypes.string,
};
const AffixStatus = {