mirror of
https://github.com/youzan/vant.git
synced 2025-10-20 02:31:21 +00:00
[bugfix] functional component should not inherit scropedSlots (#2752)
This commit is contained in:
@@ -21,8 +21,8 @@ const inheritKey = [
|
||||
const mapInheritKey: ObjectIndex = { nativeOn: 'on' };
|
||||
|
||||
// inherit partial context, map nativeOn to on
|
||||
export function inherit(context: Context): InheritContext {
|
||||
return inheritKey.reduce(
|
||||
export function inherit(context: Context, inheritListeners: boolean): InheritContext {
|
||||
const result = inheritKey.reduce(
|
||||
(obj, key) => {
|
||||
if (context.data[key]) {
|
||||
obj[mapInheritKey[key] || key] = context.data[key];
|
||||
@@ -31,6 +31,13 @@ export function inherit(context: Context): InheritContext {
|
||||
},
|
||||
{} as InheritContext
|
||||
);
|
||||
|
||||
if (inheritListeners) {
|
||||
result.on = result.on || {};
|
||||
Object.assign(result.on, context.data.on);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// emit event
|
||||
|
Reference in New Issue
Block a user