Skip to content

Commit 8d2d659

Browse files
committed
fix: function default value
1 parent 0935262 commit 8d2d659

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

components/_util/vue-types/utils.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,10 @@ export const withDefault = function(type) {
8181
warn(`${this._vueTypes_name} - invalid default value: "${def}"`, def);
8282
return this;
8383
}
84+
85+
// isFunction(def) 关注 https://github.com/vuejs/vue-next/pull/1291 合并发版本后可删除
8486
this.default =
85-
isArray(def) || isPlainObject(def)
87+
isArray(def) || isPlainObject(def) || isFunction(def)
8688
? function() {
8789
return def;
8890
}

components/affix/index.jsx

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

0 commit comments

Comments
 (0)