Comparing version 1.18.18 to 1.18.19
@@ -80,6 +80,17 @@ "use strict"; | ||
MiniComponent.prototype.triggerEvent = function (eventName, data) { | ||
var _a, _b, _c; | ||
(_c = (_b = (_a = this) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b[eventName]) === null || _c === void 0 ? void 0 : _c.call(_b, { | ||
var _a, _b, _c, _d; | ||
var props = (_a = this) === null || _a === void 0 ? void 0 : _a.props; | ||
var dataset = Object.keys(props || {}) | ||
.filter(function (property) { return property.startsWith("data-"); }) | ||
.map(function (property) { return property.replace(/^data\-/, ""); }) | ||
.reduce(function (prev, current) { | ||
prev[current] = props["data-" + current]; | ||
return prev; | ||
}, {}); | ||
(_d = (_c = (_b = this) === null || _b === void 0 ? void 0 : _b.props) === null || _c === void 0 ? void 0 : _c[eventName]) === null || _d === void 0 ? void 0 : _d.call(_c, { | ||
type: eventName, | ||
detail: data, | ||
currentTarget: { | ||
dataset: dataset || {}, | ||
}, | ||
}); | ||
@@ -122,4 +133,3 @@ }; | ||
if ((_a = _that.lifetimes) === null || _a === void 0 ? void 0 : _a[keyName]) { | ||
_that.lifetimes[mappings === null || mappings === void 0 ? void 0 : mappings[keyName]] = | ||
_that.lifetimes[keyName]; | ||
_that.lifetimes[mappings === null || mappings === void 0 ? void 0 : mappings[keyName]] = _that.lifetimes[keyName]; | ||
} | ||
@@ -126,0 +136,0 @@ try { |
{ | ||
"name": "mipp-ali", | ||
"version": "1.18.18", | ||
"version": "1.18.19", | ||
"description": "小程序ts", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -27,5 +27,17 @@ import clone from "rfdc"; | ||
triggerEvent<IEventData = any>(eventName: string, data?: IEventData) { | ||
const props = (this as any)?.props; | ||
const dataset = Object.keys(props || {}) | ||
.filter((property) => property.startsWith("data-")) | ||
.map((property) => property.replace(/^data\-/, "")) | ||
.reduce((prev, current) => { | ||
prev[current] = props[`data-${current}`]; | ||
return prev; | ||
}, {}); | ||
(this as any)?.props?.[eventName]?.({ | ||
type: eventName, | ||
detail: data, | ||
currentTarget: { | ||
dataset: dataset || {}, | ||
}, | ||
}); | ||
@@ -78,4 +90,3 @@ } | ||
if (_that.lifetimes?.[keyName]) { | ||
_that.lifetimes[mappings?.[keyName]] = | ||
_that.lifetimes[keyName]; | ||
_that.lifetimes[mappings?.[keyName]] = _that.lifetimes[keyName]; | ||
} | ||
@@ -82,0 +93,0 @@ |
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
662848
23255