fix: function default value

pull/2385/head
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); warn(`${this._vueTypes_name} - invalid default value: "${def}"`, def);
return this; return this;
} }
// isFunction(def) 关注 https://github.com/vuejs/vue-next/pull/1291 合并发版本后可删除
this.default = this.default =
isArray(def) || isPlainObject(def) isArray(def) || isPlainObject(def) || isFunction(def)
? function() { ? function() {
return def; return def;
} }

View File

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