提交 8d183a3f 编写于 作者: fxy060608's avatar fxy060608

fix(runtime): 原生自定义组件事件参数传递

上级 5a391a35
...@@ -489,14 +489,17 @@ function processEventExtra (vm, extra) { ...@@ -489,14 +489,17 @@ function processEventExtra (vm, extra) {
} }
function processEventArgs (vm, event, args = [], extra = [], isCustom, methodName) { function processEventArgs (vm, event, args = [], extra = [], isCustom, methodName) {
if (isCustom && !args.length) { // 无参数,直接传入 detail 数组 if (isCustom) { // 自定义事件
if (event.currentTarget && if (
event.currentTarget &&
event.currentTarget.dataset && event.currentTarget.dataset &&
event.currentTarget.dataset.comType === 'wx') { event.currentTarget.dataset.comType === 'wx'
// 使用了 wxcomponent 原生组件,传递原始 event 对象 ) { // wxcomponent 原生组件,传递原始 event 对象
return [event] return [event]
} }
return event.detail if (!args.length) { // 无参数,直接传入 detail 数组
return event.detail
}
} }
const extraObj = processEventExtra(vm, extra); const extraObj = processEventExtra(vm, extra);
......
{ {
"name": "@dcloudio/uni-app-plus", "name": "@dcloudio/uni-app-plus",
"version": "0.0.210", "version": "0.0.211",
"description": "uni-app app-plus", "description": "uni-app app-plus",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
......
...@@ -516,14 +516,17 @@ function processEventExtra (vm, extra) { ...@@ -516,14 +516,17 @@ function processEventExtra (vm, extra) {
} }
function processEventArgs (vm, event, args = [], extra = [], isCustom, methodName) { function processEventArgs (vm, event, args = [], extra = [], isCustom, methodName) {
if (isCustom && !args.length) { // 无参数,直接传入 detail 数组 if (isCustom) { // 自定义事件
if (event.currentTarget && if (
event.currentTarget &&
event.currentTarget.dataset && event.currentTarget.dataset &&
event.currentTarget.dataset.comType === 'wx') { event.currentTarget.dataset.comType === 'wx'
// 使用了 wxcomponent 原生组件,传递原始 event 对象 ) { // wxcomponent 原生组件,传递原始 event 对象
return [event] return [event]
} }
return event.detail if (!args.length) { // 无参数,直接传入 detail 数组
return event.detail
}
} }
const extraObj = processEventExtra(vm, extra); const extraObj = processEventExtra(vm, extra);
......
{ {
"name": "@dcloudio/uni-mp-weixin", "name": "@dcloudio/uni-mp-weixin",
"version": "0.0.929", "version": "0.0.930",
"description": "uni-app mp-weixin", "description": "uni-app mp-weixin",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
......
...@@ -197,14 +197,17 @@ function processEventExtra (vm, extra) { ...@@ -197,14 +197,17 @@ function processEventExtra (vm, extra) {
} }
function processEventArgs (vm, event, args = [], extra = [], isCustom, methodName) { function processEventArgs (vm, event, args = [], extra = [], isCustom, methodName) {
if (isCustom && !args.length) { // 无参数,直接传入 detail 数组 if (isCustom) { // 自定义事件
if (event.currentTarget && if (
event.currentTarget &&
event.currentTarget.dataset && event.currentTarget.dataset &&
event.currentTarget.dataset.comType === 'wx') { event.currentTarget.dataset.comType === 'wx'
// 使用了 wxcomponent 原生组件,传递原始 event 对象 ) { // wxcomponent 原生组件,传递原始 event 对象
return [event] return [event]
} }
return event.detail if (!args.length) { // 无参数,直接传入 detail 数组
return event.detail
}
} }
const extraObj = processEventExtra(vm, extra) const extraObj = processEventExtra(vm, extra)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册