Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ripplebb
uni-app
提交
9c99f06a
U
uni-app
项目概览
ripplebb
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9c99f06a
编写于
9月 07, 2022
作者:
Q
qiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: build
上级
6a4fff34
变更
13
展开全部
隐藏空白更改
内联
并排
Showing
13 changed file
with
212 addition
and
135 deletion
+212
-135
packages/uni-app-plus/dist/index.js
packages/uni-app-plus/dist/index.js
+18
-12
packages/uni-app-plus/dist/index.v3.js
packages/uni-app-plus/dist/index.v3.js
+6
-3
packages/uni-h5/dist/index.umd.min.js
packages/uni-h5/dist/index.umd.min.js
+1
-1
packages/uni-mp-alipay/dist/index.js
packages/uni-mp-alipay/dist/index.js
+13
-11
packages/uni-mp-baidu/dist/index.js
packages/uni-mp-baidu/dist/index.js
+18
-12
packages/uni-mp-jd/dist/index.js
packages/uni-mp-jd/dist/index.js
+18
-12
packages/uni-mp-kuaishou/dist/index.js
packages/uni-mp-kuaishou/dist/index.js
+18
-12
packages/uni-mp-lark/dist/index.js
packages/uni-mp-lark/dist/index.js
+18
-12
packages/uni-mp-qq/dist/index.js
packages/uni-mp-qq/dist/index.js
+24
-12
packages/uni-mp-toutiao/dist/index.js
packages/uni-mp-toutiao/dist/index.js
+18
-12
packages/uni-mp-weixin/dist/index.js
packages/uni-mp-weixin/dist/index.js
+24
-12
packages/uni-mp-xhs/dist/index.js
packages/uni-mp-xhs/dist/index.js
+18
-12
packages/uni-quickapp-webview/dist/index.js
packages/uni-quickapp-webview/dist/index.js
+18
-12
未找到文件。
packages/uni-app-plus/dist/index.js
浏览文件 @
9c99f06a
...
@@ -1048,7 +1048,11 @@ const customize = cached((str) => {
...
@@ -1048,7 +1048,11 @@ const customize = cached((str) => {
function
initTriggerEvent
(
mpInstance
)
{
function
initTriggerEvent
(
mpInstance
)
{
const
oldTriggerEvent
=
mpInstance
.
triggerEvent
;
const
oldTriggerEvent
=
mpInstance
.
triggerEvent
;
const
newTriggerEvent
=
function
(
event
,
...
args
)
{
const
newTriggerEvent
=
function
(
event
,
...
args
)
{
return
oldTriggerEvent
.
apply
(
mpInstance
,
[
customize
(
event
),
...
args
])
// 事件名统一转驼峰格式,仅处理:当前组件为 vue 组件、当前组件为 vue 组件子组件
if
(
this
.
$vm
||
(
this
.
dataset
&&
this
.
dataset
.
comType
))
{
event
=
customize
(
event
);
}
return
oldTriggerEvent
.
apply
(
this
,
[
event
,
...
args
])
};
};
try
{
try
{
// 京东小程序 triggerEvent 为只读
// 京东小程序 triggerEvent 为只读
...
@@ -1220,7 +1224,7 @@ function initData (vueOptions, context) {
...
@@ -1220,7 +1224,7 @@ function initData (vueOptions, context) {
try
{
try
{
// 对 data 格式化
// 对 data 格式化
data
=
JSON
.
parse
(
JSON
.
stringify
(
data
));
data
=
JSON
.
parse
(
JSON
.
stringify
(
data
));
}
catch
(
e
)
{}
}
catch
(
e
)
{
}
}
}
if
(
!
isPlainObject
(
data
))
{
if
(
!
isPlainObject
(
data
))
{
...
@@ -1372,7 +1376,7 @@ function wrapper$2 (event) {
...
@@ -1372,7 +1376,7 @@ function wrapper$2 (event) {
// TODO 又得兼容 mpvue 的 mp 对象
// TODO 又得兼容 mpvue 的 mp 对象
try
{
try
{
event
.
mp
=
JSON
.
parse
(
JSON
.
stringify
(
event
));
event
.
mp
=
JSON
.
parse
(
JSON
.
stringify
(
event
));
}
catch
(
e
)
{}
}
catch
(
e
)
{
}
event
.
stopPropagation
=
noop
;
event
.
stopPropagation
=
noop
;
event
.
preventDefault
=
noop
;
event
.
preventDefault
=
noop
;
...
@@ -1443,7 +1447,7 @@ function getExtraValue (vm, dataPathsArray) {
...
@@ -1443,7 +1447,7 @@ function getExtraValue (vm, dataPathsArray) {
return
context
return
context
}
}
function
processEventExtra
(
vm
,
extra
,
event
)
{
function
processEventExtra
(
vm
,
extra
,
event
,
__args__
)
{
const
extraObj
=
{};
const
extraObj
=
{};
if
(
Array
.
isArray
(
extra
)
&&
extra
.
length
)
{
if
(
Array
.
isArray
(
extra
)
&&
extra
.
length
)
{
...
@@ -1466,11 +1470,7 @@ function processEventExtra (vm, extra, event) {
...
@@ -1466,11 +1470,7 @@ function processEventExtra (vm, extra, event) {
if
(
dataPath
===
'
$event
'
)
{
// $event
if
(
dataPath
===
'
$event
'
)
{
// $event
extraObj
[
'
$
'
+
index
]
=
event
;
extraObj
[
'
$
'
+
index
]
=
event
;
}
else
if
(
dataPath
===
'
arguments
'
)
{
}
else
if
(
dataPath
===
'
arguments
'
)
{
if
(
event
.
detail
&&
event
.
detail
.
__args__
)
{
extraObj
[
'
$
'
+
index
]
=
event
.
detail
?
event
.
detail
.
__args__
||
__args__
:
__args__
;
extraObj
[
'
$
'
+
index
]
=
event
.
detail
.
__args__
;
}
else
{
extraObj
[
'
$
'
+
index
]
=
[
event
];
}
}
else
if
(
dataPath
.
indexOf
(
'
$event.
'
)
===
0
)
{
// $event.target.value
}
else
if
(
dataPath
.
indexOf
(
'
$event.
'
)
===
0
)
{
// $event.target.value
extraObj
[
'
$
'
+
index
]
=
vm
.
__get_value
(
dataPath
.
replace
(
'
$event.
'
,
''
),
event
);
extraObj
[
'
$
'
+
index
]
=
vm
.
__get_value
(
dataPath
.
replace
(
'
$event.
'
,
''
),
event
);
}
else
{
}
else
{
...
@@ -1497,6 +1497,12 @@ function getObjByArray (arr) {
...
@@ -1497,6 +1497,12 @@ function getObjByArray (arr) {
function
processEventArgs
(
vm
,
event
,
args
=
[],
extra
=
[],
isCustom
,
methodName
)
{
function
processEventArgs
(
vm
,
event
,
args
=
[],
extra
=
[],
isCustom
,
methodName
)
{
let
isCustomMPEvent
=
false
;
// wxcomponent 组件,传递原始 event 对象
let
isCustomMPEvent
=
false
;
// wxcomponent 组件,传递原始 event 对象
// fixed 用户直接触发 mpInstance.triggerEvent
const
__args__
=
isPlainObject
(
event
.
detail
)
?
event
.
detail
.
__args__
||
[
event
.
detail
]
:
[
event
.
detail
];
if
(
isCustom
)
{
// 自定义事件
if
(
isCustom
)
{
// 自定义事件
isCustomMPEvent
=
event
.
currentTarget
&&
isCustomMPEvent
=
event
.
currentTarget
&&
event
.
currentTarget
.
dataset
&&
event
.
currentTarget
.
dataset
&&
...
@@ -1505,11 +1511,11 @@ function processEventArgs (vm, event, args = [], extra = [], isCustom, methodNam
...
@@ -1505,11 +1511,11 @@ function processEventArgs (vm, event, args = [], extra = [], isCustom, methodNam
if
(
isCustomMPEvent
)
{
if
(
isCustomMPEvent
)
{
return
[
event
]
return
[
event
]
}
}
return
event
.
detail
.
__args__
||
event
.
detail
return
__args__
}
}
}
}
const
extraObj
=
processEventExtra
(
vm
,
extra
,
event
);
const
extraObj
=
processEventExtra
(
vm
,
extra
,
event
,
__args__
);
const
ret
=
[];
const
ret
=
[];
args
.
forEach
(
arg
=>
{
args
.
forEach
(
arg
=>
{
...
@@ -1518,7 +1524,7 @@ function processEventArgs (vm, event, args = [], extra = [], isCustom, methodNam
...
@@ -1518,7 +1524,7 @@ function processEventArgs (vm, event, args = [], extra = [], isCustom, methodNam
ret
.
push
(
event
.
target
.
value
);
ret
.
push
(
event
.
target
.
value
);
}
else
{
}
else
{
if
(
isCustom
&&
!
isCustomMPEvent
)
{
if
(
isCustom
&&
!
isCustomMPEvent
)
{
ret
.
push
(
event
.
detail
.
__args__
[
0
]);
ret
.
push
(
__args__
[
0
]);
}
else
{
// wxcomponent 组件或内置组件
}
else
{
// wxcomponent 组件或内置组件
ret
.
push
(
event
);
ret
.
push
(
event
);
}
}
...
...
packages/uni-app-plus/dist/index.v3.js
浏览文件 @
9c99f06a
...
@@ -21812,6 +21812,7 @@ var serviceContext = (function () {
...
@@ -21812,6 +21812,7 @@ var serviceContext = (function () {
this._page = page;
this._page = page;
this._queue = [];
this._queue = [];
this._queueCb = [];
this._queueCb = [];
this._nodesRef = null;
}
}
exec (callback) {
exec (callback) {
...
@@ -21830,6 +21831,8 @@ var serviceContext = (function () {
...
@@ -21830,6 +21831,8 @@ var serviceContext = (function () {
});
});
isFn(callback) && callback.call(this, res);
isFn(callback) && callback.call(this, res);
});
});
return this._nodesRef
}
}
['in'] (component) {
['in'] (component) {
...
@@ -21839,15 +21842,15 @@ var serviceContext = (function () {
...
@@ -21839,15 +21842,15 @@ var serviceContext = (function () {
}
}
select (selector) {
select (selector) {
return
new NodesRef(this, this._component, selector, true
)
return
(this._nodesRef = new NodesRef(this, this._component, selector, true)
)
}
}
selectAll (selector) {
selectAll (selector) {
return
new NodesRef(this, this._component, selector, false
)
return
(this._nodesRef = new NodesRef(this, this._component, selector, false)
)
}
}
selectViewport () {
selectViewport () {
return
new NodesRef(this, 0, '', true
)
return
(this._nodesRef = new NodesRef(this, 0, '', true)
)
}
}
_push (selector, component, single, fields, callback) {
_push (selector, component, single, fields, callback) {
...
...
packages/uni-h5/dist/index.umd.min.js
浏览文件 @
9c99f06a
此差异已折叠。
点击以展开。
packages/uni-mp-alipay/dist/index.js
浏览文件 @
9c99f06a
...
@@ -2051,7 +2051,7 @@ function initData (vueOptions, context) {
...
@@ -2051,7 +2051,7 @@ function initData (vueOptions, context) {
try
{
try
{
// 对 data 格式化
// 对 data 格式化
data
=
JSON
.
parse
(
JSON
.
stringify
(
data
));
data
=
JSON
.
parse
(
JSON
.
stringify
(
data
));
}
catch
(
e
)
{}
}
catch
(
e
)
{
}
}
}
if
(
!
isPlainObject
(
data
))
{
if
(
!
isPlainObject
(
data
))
{
...
@@ -2199,7 +2199,7 @@ function wrapper$1 (event) {
...
@@ -2199,7 +2199,7 @@ function wrapper$1 (event) {
// TODO 又得兼容 mpvue 的 mp 对象
// TODO 又得兼容 mpvue 的 mp 对象
try
{
try
{
event
.
mp
=
JSON
.
parse
(
JSON
.
stringify
(
event
));
event
.
mp
=
JSON
.
parse
(
JSON
.
stringify
(
event
));
}
catch
(
e
)
{}
}
catch
(
e
)
{
}
event
.
stopPropagation
=
noop
;
event
.
stopPropagation
=
noop
;
event
.
preventDefault
=
noop
;
event
.
preventDefault
=
noop
;
...
@@ -2270,7 +2270,7 @@ function getExtraValue (vm, dataPathsArray) {
...
@@ -2270,7 +2270,7 @@ function getExtraValue (vm, dataPathsArray) {
return
context
return
context
}
}
function
processEventExtra
(
vm
,
extra
,
event
)
{
function
processEventExtra
(
vm
,
extra
,
event
,
__args__
)
{
const
extraObj
=
{};
const
extraObj
=
{};
if
(
Array
.
isArray
(
extra
)
&&
extra
.
length
)
{
if
(
Array
.
isArray
(
extra
)
&&
extra
.
length
)
{
...
@@ -2293,11 +2293,7 @@ function processEventExtra (vm, extra, event) {
...
@@ -2293,11 +2293,7 @@ function processEventExtra (vm, extra, event) {
if
(
dataPath
===
'
$event
'
)
{
// $event
if
(
dataPath
===
'
$event
'
)
{
// $event
extraObj
[
'
$
'
+
index
]
=
event
;
extraObj
[
'
$
'
+
index
]
=
event
;
}
else
if
(
dataPath
===
'
arguments
'
)
{
}
else
if
(
dataPath
===
'
arguments
'
)
{
if
(
event
.
detail
&&
event
.
detail
.
__args__
)
{
extraObj
[
'
$
'
+
index
]
=
event
.
detail
?
event
.
detail
.
__args__
||
__args__
:
__args__
;
extraObj
[
'
$
'
+
index
]
=
event
.
detail
.
__args__
;
}
else
{
extraObj
[
'
$
'
+
index
]
=
[
event
];
}
}
else
if
(
dataPath
.
indexOf
(
'
$event.
'
)
===
0
)
{
// $event.target.value
}
else
if
(
dataPath
.
indexOf
(
'
$event.
'
)
===
0
)
{
// $event.target.value
extraObj
[
'
$
'
+
index
]
=
vm
.
__get_value
(
dataPath
.
replace
(
'
$event.
'
,
''
),
event
);
extraObj
[
'
$
'
+
index
]
=
vm
.
__get_value
(
dataPath
.
replace
(
'
$event.
'
,
''
),
event
);
}
else
{
}
else
{
...
@@ -2324,6 +2320,12 @@ function getObjByArray (arr) {
...
@@ -2324,6 +2320,12 @@ function getObjByArray (arr) {
function
processEventArgs
(
vm
,
event
,
args
=
[],
extra
=
[],
isCustom
,
methodName
)
{
function
processEventArgs
(
vm
,
event
,
args
=
[],
extra
=
[],
isCustom
,
methodName
)
{
let
isCustomMPEvent
=
false
;
// wxcomponent 组件,传递原始 event 对象
let
isCustomMPEvent
=
false
;
// wxcomponent 组件,传递原始 event 对象
// fixed 用户直接触发 mpInstance.triggerEvent
const
__args__
=
isPlainObject
(
event
.
detail
)
?
event
.
detail
.
__args__
||
[
event
.
detail
]
:
[
event
.
detail
];
if
(
isCustom
)
{
// 自定义事件
if
(
isCustom
)
{
// 自定义事件
isCustomMPEvent
=
event
.
currentTarget
&&
isCustomMPEvent
=
event
.
currentTarget
&&
event
.
currentTarget
.
dataset
&&
event
.
currentTarget
.
dataset
&&
...
@@ -2332,11 +2334,11 @@ function processEventArgs (vm, event, args = [], extra = [], isCustom, methodNam
...
@@ -2332,11 +2334,11 @@ function processEventArgs (vm, event, args = [], extra = [], isCustom, methodNam
if
(
isCustomMPEvent
)
{
if
(
isCustomMPEvent
)
{
return
[
event
]
return
[
event
]
}
}
return
event
.
detail
.
__args__
||
event
.
detail
return
__args__
}
}
}
}
const
extraObj
=
processEventExtra
(
vm
,
extra
,
event
);
const
extraObj
=
processEventExtra
(
vm
,
extra
,
event
,
__args__
);
const
ret
=
[];
const
ret
=
[];
args
.
forEach
(
arg
=>
{
args
.
forEach
(
arg
=>
{
...
@@ -2345,7 +2347,7 @@ function processEventArgs (vm, event, args = [], extra = [], isCustom, methodNam
...
@@ -2345,7 +2347,7 @@ function processEventArgs (vm, event, args = [], extra = [], isCustom, methodNam
ret
.
push
(
event
.
target
.
value
);
ret
.
push
(
event
.
target
.
value
);
}
else
{
}
else
{
if
(
isCustom
&&
!
isCustomMPEvent
)
{
if
(
isCustom
&&
!
isCustomMPEvent
)
{
ret
.
push
(
event
.
detail
.
__args__
[
0
]);
ret
.
push
(
__args__
[
0
]);
}
else
{
// wxcomponent 组件或内置组件
}
else
{
// wxcomponent 组件或内置组件
ret
.
push
(
event
);
ret
.
push
(
event
);
}
}
...
...
packages/uni-mp-baidu/dist/index.js
浏览文件 @
9c99f06a
...
@@ -1512,7 +1512,11 @@ const customize = cached((str) => {
...
@@ -1512,7 +1512,11 @@ const customize = cached((str) => {
function
initTriggerEvent
(
mpInstance
)
{
function
initTriggerEvent
(
mpInstance
)
{
const
oldTriggerEvent
=
mpInstance
.
triggerEvent
;
const
oldTriggerEvent
=
mpInstance
.
triggerEvent
;
const
newTriggerEvent
=
function
(
event
,
...
args
)
{
const
newTriggerEvent
=
function
(
event
,
...
args
)
{
return
oldTriggerEvent
.
apply
(
mpInstance
,
[
customize
(
event
),
...
args
])
// 事件名统一转驼峰格式,仅处理:当前组件为 vue 组件、当前组件为 vue 组件子组件
if
(
this
.
$vm
||
(
this
.
dataset
&&
this
.
dataset
.
comType
))
{
event
=
customize
(
event
);
}
return
oldTriggerEvent
.
apply
(
this
,
[
event
,
...
args
])
};
};
try
{
try
{
// 京东小程序 triggerEvent 为只读
// 京东小程序 triggerEvent 为只读
...
@@ -1684,7 +1688,7 @@ function initData (vueOptions, context) {
...
@@ -1684,7 +1688,7 @@ function initData (vueOptions, context) {
try
{
try
{
// 对 data 格式化
// 对 data 格式化
data
=
JSON
.
parse
(
JSON
.
stringify
(
data
));
data
=
JSON
.
parse
(
JSON
.
stringify
(
data
));
}
catch
(
e
)
{}
}
catch
(
e
)
{
}
}
}
if
(
!
isPlainObject
(
data
))
{
if
(
!
isPlainObject
(
data
))
{
...
@@ -1852,7 +1856,7 @@ function wrapper$1 (event) {
...
@@ -1852,7 +1856,7 @@ function wrapper$1 (event) {
// TODO 又得兼容 mpvue 的 mp 对象
// TODO 又得兼容 mpvue 的 mp 对象
try
{
try
{
event
.
mp
=
JSON
.
parse
(
JSON
.
stringify
(
event
));
event
.
mp
=
JSON
.
parse
(
JSON
.
stringify
(
event
));
}
catch
(
e
)
{}
}
catch
(
e
)
{
}
event
.
stopPropagation
=
noop
;
event
.
stopPropagation
=
noop
;
event
.
preventDefault
=
noop
;
event
.
preventDefault
=
noop
;
...
@@ -1933,7 +1937,7 @@ function getExtraValue (vm, dataPathsArray) {
...
@@ -1933,7 +1937,7 @@ function getExtraValue (vm, dataPathsArray) {
return
context
return
context
}
}
function
processEventExtra
(
vm
,
extra
,
event
)
{
function
processEventExtra
(
vm
,
extra
,
event
,
__args__
)
{
const
extraObj
=
{};
const
extraObj
=
{};
if
(
Array
.
isArray
(
extra
)
&&
extra
.
length
)
{
if
(
Array
.
isArray
(
extra
)
&&
extra
.
length
)
{
...
@@ -1956,11 +1960,7 @@ function processEventExtra (vm, extra, event) {
...
@@ -1956,11 +1960,7 @@ function processEventExtra (vm, extra, event) {
if
(
dataPath
===
'
$event
'
)
{
// $event
if
(
dataPath
===
'
$event
'
)
{
// $event
extraObj
[
'
$
'
+
index
]
=
event
;
extraObj
[
'
$
'
+
index
]
=
event
;
}
else
if
(
dataPath
===
'
arguments
'
)
{
}
else
if
(
dataPath
===
'
arguments
'
)
{
if
(
event
.
detail
&&
event
.
detail
.
__args__
)
{
extraObj
[
'
$
'
+
index
]
=
event
.
detail
?
event
.
detail
.
__args__
||
__args__
:
__args__
;
extraObj
[
'
$
'
+
index
]
=
event
.
detail
.
__args__
;
}
else
{
extraObj
[
'
$
'
+
index
]
=
[
event
];
}
}
else
if
(
dataPath
.
indexOf
(
'
$event.
'
)
===
0
)
{
// $event.target.value
}
else
if
(
dataPath
.
indexOf
(
'
$event.
'
)
===
0
)
{
// $event.target.value
extraObj
[
'
$
'
+
index
]
=
vm
.
__get_value
(
dataPath
.
replace
(
'
$event.
'
,
''
),
event
);
extraObj
[
'
$
'
+
index
]
=
vm
.
__get_value
(
dataPath
.
replace
(
'
$event.
'
,
''
),
event
);
}
else
{
}
else
{
...
@@ -1987,6 +1987,12 @@ function getObjByArray (arr) {
...
@@ -1987,6 +1987,12 @@ function getObjByArray (arr) {
function
processEventArgs
(
vm
,
event
,
args
=
[],
extra
=
[],
isCustom
,
methodName
)
{
function
processEventArgs
(
vm
,
event
,
args
=
[],
extra
=
[],
isCustom
,
methodName
)
{
let
isCustomMPEvent
=
false
;
// wxcomponent 组件,传递原始 event 对象
let
isCustomMPEvent
=
false
;
// wxcomponent 组件,传递原始 event 对象
// fixed 用户直接触发 mpInstance.triggerEvent
const
__args__
=
isPlainObject
(
event
.
detail
)
?
event
.
detail
.
__args__
||
[
event
.
detail
]
:
[
event
.
detail
];
if
(
isCustom
)
{
// 自定义事件
if
(
isCustom
)
{
// 自定义事件
isCustomMPEvent
=
event
.
currentTarget
&&
isCustomMPEvent
=
event
.
currentTarget
&&
event
.
currentTarget
.
dataset
&&
event
.
currentTarget
.
dataset
&&
...
@@ -1995,11 +2001,11 @@ function processEventArgs (vm, event, args = [], extra = [], isCustom, methodNam
...
@@ -1995,11 +2001,11 @@ function processEventArgs (vm, event, args = [], extra = [], isCustom, methodNam
if
(
isCustomMPEvent
)
{
if
(
isCustomMPEvent
)
{
return
[
event
]
return
[
event
]
}
}
return
event
.
detail
.
__args__
||
event
.
detail
return
__args__
}
}
}
}
const
extraObj
=
processEventExtra
(
vm
,
extra
,
event
);
const
extraObj
=
processEventExtra
(
vm
,
extra
,
event
,
__args__
);
const
ret
=
[];
const
ret
=
[];
args
.
forEach
(
arg
=>
{
args
.
forEach
(
arg
=>
{
...
@@ -2008,7 +2014,7 @@ function processEventArgs (vm, event, args = [], extra = [], isCustom, methodNam
...
@@ -2008,7 +2014,7 @@ function processEventArgs (vm, event, args = [], extra = [], isCustom, methodNam
ret
.
push
(
event
.
target
.
value
);
ret
.
push
(
event
.
target
.
value
);
}
else
{
}
else
{
if
(
isCustom
&&
!
isCustomMPEvent
)
{
if
(
isCustom
&&
!
isCustomMPEvent
)
{
ret
.
push
(
event
.
detail
.
__args__
[
0
]);
ret
.
push
(
__args__
[
0
]);
}
else
{
// wxcomponent 组件或内置组件
}
else
{
// wxcomponent 组件或内置组件
ret
.
push
(
event
);
ret
.
push
(
event
);
}
}
...
...
packages/uni-mp-jd/dist/index.js
浏览文件 @
9c99f06a
...
@@ -1129,7 +1129,11 @@ const customize = cached((str) => {
...
@@ -1129,7 +1129,11 @@ const customize = cached((str) => {
function
initTriggerEvent
(
mpInstance
)
{
function
initTriggerEvent
(
mpInstance
)
{
const
oldTriggerEvent
=
mpInstance
.
triggerEvent
;
const
oldTriggerEvent
=
mpInstance
.
triggerEvent
;
const
newTriggerEvent
=
function
(
event
,
...
args
)
{
const
newTriggerEvent
=
function
(
event
,
...
args
)
{
return
oldTriggerEvent
.
apply
(
mpInstance
,
[
customize
(
event
),
...
args
])
// 事件名统一转驼峰格式,仅处理:当前组件为 vue 组件、当前组件为 vue 组件子组件
if
(
this
.
$vm
||
(
this
.
dataset
&&
this
.
dataset
.
comType
))
{
event
=
customize
(
event
);
}
return
oldTriggerEvent
.
apply
(
this
,
[
event
,
...
args
])
};
};
try
{
try
{
// 京东小程序 triggerEvent 为只读
// 京东小程序 triggerEvent 为只读
...
@@ -1301,7 +1305,7 @@ function initData (vueOptions, context) {
...
@@ -1301,7 +1305,7 @@ function initData (vueOptions, context) {
try
{
try
{
// 对 data 格式化
// 对 data 格式化
data
=
JSON
.
parse
(
JSON
.
stringify
(
data
));
data
=
JSON
.
parse
(
JSON
.
stringify
(
data
));
}
catch
(
e
)
{}
}
catch
(
e
)
{
}
}
}
if
(
!
isPlainObject
(
data
))
{
if
(
!
isPlainObject
(
data
))
{
...
@@ -1453,7 +1457,7 @@ function wrapper$1 (event) {
...
@@ -1453,7 +1457,7 @@ function wrapper$1 (event) {
// TODO 又得兼容 mpvue 的 mp 对象
// TODO 又得兼容 mpvue 的 mp 对象
try
{
try
{
event
.
mp
=
JSON
.
parse
(
JSON
.
stringify
(
event
));
event
.
mp
=
JSON
.
parse
(
JSON
.
stringify
(
event
));
}
catch
(
e
)
{}
}
catch
(
e
)
{
}
event
.
stopPropagation
=
noop
;
event
.
stopPropagation
=
noop
;
event
.
preventDefault
=
noop
;
event
.
preventDefault
=
noop
;
...
@@ -1524,7 +1528,7 @@ function getExtraValue (vm, dataPathsArray) {
...
@@ -1524,7 +1528,7 @@ function getExtraValue (vm, dataPathsArray) {
return
context
return
context
}
}
function
processEventExtra
(
vm
,
extra
,
event
)
{
function
processEventExtra
(
vm
,
extra
,
event
,
__args__
)
{
const
extraObj
=
{};
const
extraObj
=
{};
if
(
Array
.
isArray
(
extra
)
&&
extra
.
length
)
{
if
(
Array
.
isArray
(
extra
)
&&
extra
.
length
)
{
...
@@ -1547,11 +1551,7 @@ function processEventExtra (vm, extra, event) {
...
@@ -1547,11 +1551,7 @@ function processEventExtra (vm, extra, event) {
if
(
dataPath
===
'
$event
'
)
{
// $event
if
(
dataPath
===
'
$event
'
)
{
// $event
extraObj
[
'
$
'
+
index
]
=
event
;
extraObj
[
'
$
'
+
index
]
=
event
;
}
else
if
(
dataPath
===
'
arguments
'
)
{
}
else
if
(
dataPath
===
'
arguments
'
)
{
if
(
event
.
detail
&&
event
.
detail
.
__args__
)
{
extraObj
[
'
$
'
+
index
]
=
event
.
detail
?
event
.
detail
.
__args__
||
__args__
:
__args__
;
extraObj
[
'
$
'
+
index
]
=
event
.
detail
.
__args__
;
}
else
{
extraObj
[
'
$
'
+
index
]
=
[
event
];
}
}
else
if
(
dataPath
.
indexOf
(
'
$event.
'
)
===
0
)
{
// $event.target.value
}
else
if
(
dataPath
.
indexOf
(
'
$event.
'
)
===
0
)
{
// $event.target.value
extraObj
[
'
$
'
+
index
]
=
vm
.
__get_value
(
dataPath
.
replace
(
'
$event.
'
,
''
),
event
);
extraObj
[
'
$
'
+
index
]
=
vm
.
__get_value
(
dataPath
.
replace
(
'
$event.
'
,
''
),
event
);
}
else
{
}
else
{
...
@@ -1578,6 +1578,12 @@ function getObjByArray (arr) {
...
@@ -1578,6 +1578,12 @@ function getObjByArray (arr) {
function
processEventArgs
(
vm
,
event
,
args
=
[],
extra
=
[],
isCustom
,
methodName
)
{
function
processEventArgs
(
vm
,
event
,
args
=
[],
extra
=
[],
isCustom
,
methodName
)
{
let
isCustomMPEvent
=
false
;
// wxcomponent 组件,传递原始 event 对象
let
isCustomMPEvent
=
false
;
// wxcomponent 组件,传递原始 event 对象
// fixed 用户直接触发 mpInstance.triggerEvent
const
__args__
=
isPlainObject
(
event
.
detail
)
?
event
.
detail
.
__args__
||
[
event
.
detail
]
:
[
event
.
detail
];
if
(
isCustom
)
{
// 自定义事件
if
(
isCustom
)
{
// 自定义事件
isCustomMPEvent
=
event
.
currentTarget
&&
isCustomMPEvent
=
event
.
currentTarget
&&
event
.
currentTarget
.
dataset
&&
event
.
currentTarget
.
dataset
&&
...
@@ -1586,11 +1592,11 @@ function processEventArgs (vm, event, args = [], extra = [], isCustom, methodNam
...
@@ -1586,11 +1592,11 @@ function processEventArgs (vm, event, args = [], extra = [], isCustom, methodNam
if
(
isCustomMPEvent
)
{
if
(
isCustomMPEvent
)
{
return
[
event
]
return
[
event
]
}
}
return
event
.
detail
.
__args__
||
event
.
detail
return
__args__
}
}
}
}
const
extraObj
=
processEventExtra
(
vm
,
extra
,
event
);
const
extraObj
=
processEventExtra
(
vm
,
extra
,
event
,
__args__
);
const
ret
=
[];
const
ret
=
[];
args
.
forEach
(
arg
=>
{
args
.
forEach
(
arg
=>
{
...
@@ -1599,7 +1605,7 @@ function processEventArgs (vm, event, args = [], extra = [], isCustom, methodNam
...
@@ -1599,7 +1605,7 @@ function processEventArgs (vm, event, args = [], extra = [], isCustom, methodNam
ret
.
push
(
event
.
target
.
value
);
ret
.
push
(
event
.
target
.
value
);
}
else
{
}
else
{
if
(
isCustom
&&
!
isCustomMPEvent
)
{
if
(
isCustom
&&
!
isCustomMPEvent
)
{
ret
.
push
(
event
.
detail
.
__args__
[
0
]);
ret
.
push
(
__args__
[
0
]);
}
else
{
// wxcomponent 组件或内置组件
}
else
{
// wxcomponent 组件或内置组件
ret
.
push
(
event
);
ret
.
push
(
event
);
}
}
...
...
packages/uni-mp-kuaishou/dist/index.js
浏览文件 @
9c99f06a
...
@@ -1297,7 +1297,11 @@ const customize = cached((str) => {
...
@@ -1297,7 +1297,11 @@ const customize = cached((str) => {
function
initTriggerEvent
(
mpInstance
)
{
function
initTriggerEvent
(
mpInstance
)
{
const
oldTriggerEvent
=
mpInstance
.
triggerEvent
;
const
oldTriggerEvent
=
mpInstance
.
triggerEvent
;
const
newTriggerEvent
=
function
(
event
,
...
args
)
{
const
newTriggerEvent
=
function
(
event
,
...
args
)
{
return
oldTriggerEvent
.
apply
(
mpInstance
,
[
customize
(
event
),
...
args
])
// 事件名统一转驼峰格式,仅处理:当前组件为 vue 组件、当前组件为 vue 组件子组件
if
(
this
.
$vm
||
(
this
.
dataset
&&
this
.
dataset
.
comType
))
{
event
=
customize
(
event
);
}
return
oldTriggerEvent
.
apply
(
this
,
[
event
,
...
args
])
};
};
try
{
try
{
// 京东小程序 triggerEvent 为只读
// 京东小程序 triggerEvent 为只读
...
@@ -1469,7 +1473,7 @@ function initData (vueOptions, context) {
...
@@ -1469,7 +1473,7 @@ function initData (vueOptions, context) {
try
{
try
{
// 对 data 格式化
// 对 data 格式化
data
=
JSON
.
parse
(
JSON
.
stringify
(
data
));
data
=
JSON
.
parse
(
JSON
.
stringify
(
data
));
}
catch
(
e
)
{}
}
catch
(
e
)
{
}
}
}
if
(
!
isPlainObject
(
data
))
{
if
(
!
isPlainObject
(
data
))
{
...
@@ -1621,7 +1625,7 @@ function wrapper$1 (event) {
...
@@ -1621,7 +1625,7 @@ function wrapper$1 (event) {
// TODO 又得兼容 mpvue 的 mp 对象
// TODO 又得兼容 mpvue 的 mp 对象
try
{
try
{
event
.
mp
=
JSON
.
parse
(
JSON
.
stringify
(
event
));
event
.
mp
=
JSON
.
parse
(
JSON
.
stringify
(
event
));
}
catch
(
e
)
{}
}
catch
(
e
)
{
}
event
.
stopPropagation
=
noop
;
event
.
stopPropagation
=
noop
;
event
.
preventDefault
=
noop
;
event
.
preventDefault
=
noop
;
...
@@ -1692,7 +1696,7 @@ function getExtraValue (vm, dataPathsArray) {
...
@@ -1692,7 +1696,7 @@ function getExtraValue (vm, dataPathsArray) {
return
context
return
context
}
}
function
processEventExtra
(
vm
,
extra
,
event
)
{
function
processEventExtra
(
vm
,
extra
,
event
,
__args__
)
{
const
extraObj
=
{};
const
extraObj
=
{};
if
(
Array
.
isArray
(
extra
)
&&
extra
.
length
)
{
if
(
Array
.
isArray
(
extra
)
&&
extra
.
length
)
{
...
@@ -1715,11 +1719,7 @@ function processEventExtra (vm, extra, event) {
...
@@ -1715,11 +1719,7 @@ function processEventExtra (vm, extra, event) {
if
(
dataPath
===
'
$event
'
)
{
// $event
if
(
dataPath
===
'
$event
'
)
{
// $event
extraObj
[
'
$
'
+
index
]
=
event
;
extraObj
[
'
$
'
+
index
]
=
event
;
}
else
if
(
dataPath
===
'
arguments
'
)
{
}
else
if
(
dataPath
===
'
arguments
'
)
{
if
(
event
.
detail
&&
event
.
detail
.
__args__
)
{
extraObj
[
'
$
'
+
index
]
=
event
.
detail
?
event
.
detail
.
__args__
||
__args__
:
__args__
;
extraObj
[
'
$
'
+
index
]
=
event
.
detail
.
__args__
;
}
else
{
extraObj
[
'
$
'
+
index
]
=
[
event
];
}
}
else
if
(
dataPath
.
indexOf
(
'
$event.
'
)
===
0
)
{
// $event.target.value
}
else
if
(
dataPath
.
indexOf
(
'
$event.
'
)
===
0
)
{
// $event.target.value
extraObj
[
'
$
'
+
index
]
=
vm
.
__get_value
(
dataPath
.
replace
(
'
$event.
'
,
''
),
event
);
extraObj
[
'
$
'
+
index
]
=
vm
.
__get_value
(
dataPath
.
replace
(
'
$event.
'
,
''
),
event
);
}
else
{
}
else
{
...
@@ -1746,6 +1746,12 @@ function getObjByArray (arr) {
...
@@ -1746,6 +1746,12 @@ function getObjByArray (arr) {
function
processEventArgs
(
vm
,
event
,
args
=
[],
extra
=
[],
isCustom
,
methodName
)
{
function
processEventArgs
(
vm
,
event
,
args
=
[],
extra
=
[],
isCustom
,
methodName
)
{
let
isCustomMPEvent
=
false
;
// wxcomponent 组件,传递原始 event 对象
let
isCustomMPEvent
=
false
;
// wxcomponent 组件,传递原始 event 对象
// fixed 用户直接触发 mpInstance.triggerEvent
const
__args__
=
isPlainObject
(
event
.
detail
)
?
event
.
detail
.
__args__
||
[
event
.
detail
]
:
[
event
.
detail
];
if
(
isCustom
)
{
// 自定义事件
if
(
isCustom
)
{
// 自定义事件
isCustomMPEvent
=
event
.
currentTarget
&&
isCustomMPEvent
=
event
.
currentTarget
&&
event
.
currentTarget
.
dataset
&&
event
.
currentTarget
.
dataset
&&
...
@@ -1754,11 +1760,11 @@ function processEventArgs (vm, event, args = [], extra = [], isCustom, methodNam
...
@@ -1754,11 +1760,11 @@ function processEventArgs (vm, event, args = [], extra = [], isCustom, methodNam
if
(
isCustomMPEvent
)
{
if
(
isCustomMPEvent
)
{
return
[
event
]
return
[
event
]
}
}
return
event
.
detail
.
__args__
||
event
.
detail
return
__args__
}
}
}
}
const
extraObj
=
processEventExtra
(
vm
,
extra
,
event
);
const
extraObj
=
processEventExtra
(
vm
,
extra
,
event
,
__args__
);
const
ret
=
[];
const
ret
=
[];
args
.
forEach
(
arg
=>
{
args
.
forEach
(
arg
=>
{
...
@@ -1767,7 +1773,7 @@ function processEventArgs (vm, event, args = [], extra = [], isCustom, methodNam
...
@@ -1767,7 +1773,7 @@ function processEventArgs (vm, event, args = [], extra = [], isCustom, methodNam
ret
.
push
(
event
.
target
.
value
);
ret
.
push
(
event
.
target
.
value
);
}
else
{
}
else
{
if
(
isCustom
&&
!
isCustomMPEvent
)
{
if
(
isCustom
&&
!
isCustomMPEvent
)
{
ret
.
push
(
event
.
detail
.
__args__
[
0
]);
ret
.
push
(
__args__
[
0
]);
}
else
{
// wxcomponent 组件或内置组件
}
else
{
// wxcomponent 组件或内置组件
ret
.
push
(
event
);
ret
.
push
(
event
);
}
}
...
...
packages/uni-mp-lark/dist/index.js
浏览文件 @
9c99f06a
...
@@ -1347,7 +1347,11 @@ const customize = cached((str) => {
...
@@ -1347,7 +1347,11 @@ const customize = cached((str) => {
function
initTriggerEvent
(
mpInstance
)
{
function
initTriggerEvent
(
mpInstance
)
{
const
oldTriggerEvent
=
mpInstance
.
triggerEvent
;
const
oldTriggerEvent
=
mpInstance
.
triggerEvent
;
const
newTriggerEvent
=
function
(
event
,
...
args
)
{
const
newTriggerEvent
=
function
(
event
,
...
args
)
{
return
oldTriggerEvent
.
apply
(
mpInstance
,
[
customize
(
event
),
...
args
])
// 事件名统一转驼峰格式,仅处理:当前组件为 vue 组件、当前组件为 vue 组件子组件
if
(
this
.
$vm
||
(
this
.
dataset
&&
this
.
dataset
.
comType
))
{
event
=
customize
(
event
);
}
return
oldTriggerEvent
.
apply
(
this
,
[
event
,
...
args
])
};
};
try
{
try
{
// 京东小程序 triggerEvent 为只读
// 京东小程序 triggerEvent 为只读
...
@@ -1519,7 +1523,7 @@ function initData (vueOptions, context) {
...
@@ -1519,7 +1523,7 @@ function initData (vueOptions, context) {
try
{
try
{
// 对 data 格式化
// 对 data 格式化
data
=
JSON
.
parse
(
JSON
.
stringify
(
data
));
data
=
JSON
.
parse
(
JSON
.
stringify
(
data
));
}
catch
(
e
)
{}
}
catch
(
e
)
{
}
}
}
if
(
!
isPlainObject
(
data
))
{
if
(
!
isPlainObject
(
data
))
{
...
@@ -1678,7 +1682,7 @@ function wrapper$1 (event) {
...
@@ -1678,7 +1682,7 @@ function wrapper$1 (event) {
// TODO 又得兼容 mpvue 的 mp 对象
// TODO 又得兼容 mpvue 的 mp 对象
try
{
try
{
event
.
mp
=
JSON
.
parse
(
JSON
.
stringify
(
event
));
event
.
mp
=
JSON
.
parse
(
JSON
.
stringify
(
event
));
}
catch
(
e
)
{}
}
catch
(
e
)
{
}
event
.
stopPropagation
=
noop
;
event
.
stopPropagation
=
noop
;
event
.
preventDefault
=
noop
;
event
.
preventDefault
=
noop
;
...
@@ -1749,7 +1753,7 @@ function getExtraValue (vm, dataPathsArray) {
...
@@ -1749,7 +1753,7 @@ function getExtraValue (vm, dataPathsArray) {
return
context
return
context
}
}
function
processEventExtra
(
vm
,
extra
,
event
)
{
function
processEventExtra
(
vm
,
extra
,
event
,
__args__
)
{
const
extraObj
=
{};
const
extraObj
=
{};
if
(
Array
.
isArray
(
extra
)
&&
extra
.
length
)
{
if
(
Array
.
isArray
(
extra
)
&&
extra
.
length
)
{
...
@@ -1772,11 +1776,7 @@ function processEventExtra (vm, extra, event) {
...
@@ -1772,11 +1776,7 @@ function processEventExtra (vm, extra, event) {
if
(
dataPath
===
'
$event
'
)
{
// $event
if
(
dataPath
===
'
$event
'
)
{
// $event
extraObj
[
'
$
'
+
index
]
=
event
;
extraObj
[
'
$
'
+
index
]
=
event
;
}
else
if
(
dataPath
===
'
arguments
'
)
{
}
else
if
(
dataPath
===
'
arguments
'
)
{
if
(
event
.
detail
&&
event
.
detail
.
__args__
)
{
extraObj
[
'
$
'
+
index
]
=
event
.
detail
?
event
.
detail
.
__args__
||
__args__
:
__args__
;
extraObj
[
'
$
'
+
index
]
=
event
.
detail
.
__args__
;
}
else
{
extraObj
[
'
$
'
+
index
]
=
[
event
];
}
}
else
if
(
dataPath
.
indexOf
(
'
$event.
'
)
===
0
)
{
// $event.target.value
}
else
if
(
dataPath
.
indexOf
(
'
$event.
'
)
===
0
)
{
// $event.target.value
extraObj
[
'
$
'
+
index
]
=
vm
.
__get_value
(
dataPath
.
replace
(
'
$event.
'
,
''
),
event
);
extraObj
[
'
$
'
+
index
]
=
vm
.
__get_value
(
dataPath
.
replace
(
'
$event.
'
,
''
),
event
);
}
else
{
}
else
{
...
@@ -1803,6 +1803,12 @@ function getObjByArray (arr) {
...
@@ -1803,6 +1803,12 @@ function getObjByArray (arr) {
function
processEventArgs
(
vm
,
event
,
args
=
[],
extra
=
[],
isCustom
,
methodName
)
{
function
processEventArgs
(
vm
,
event
,
args
=
[],
extra
=
[],
isCustom
,
methodName
)
{
let
isCustomMPEvent
=
false
;
// wxcomponent 组件,传递原始 event 对象
let
isCustomMPEvent
=
false
;
// wxcomponent 组件,传递原始 event 对象
// fixed 用户直接触发 mpInstance.triggerEvent
const
__args__
=
isPlainObject
(
event
.
detail
)
?
event
.
detail
.
__args__
||
[
event
.
detail
]
:
[
event
.
detail
];
if
(
isCustom
)
{
// 自定义事件
if
(
isCustom
)
{
// 自定义事件
isCustomMPEvent
=
event
.
currentTarget
&&
isCustomMPEvent
=
event
.
currentTarget
&&
event
.
currentTarget
.
dataset
&&
event
.
currentTarget
.
dataset
&&
...
@@ -1811,11 +1817,11 @@ function processEventArgs (vm, event, args = [], extra = [], isCustom, methodNam
...
@@ -1811,11 +1817,11 @@ function processEventArgs (vm, event, args = [], extra = [], isCustom, methodNam
if
(
isCustomMPEvent
)
{
if
(
isCustomMPEvent
)
{
return
[
event
]
return
[
event
]
}
}
return
event
.
detail
.
__args__
||
event
.
detail
return
__args__
}
}
}
}
const
extraObj
=
processEventExtra
(
vm
,
extra
,
event
);
const
extraObj
=
processEventExtra
(
vm
,
extra
,
event
,
__args__
);
const
ret
=
[];
const
ret
=
[];
args
.
forEach
(
arg
=>
{
args
.
forEach
(
arg
=>
{
...
@@ -1824,7 +1830,7 @@ function processEventArgs (vm, event, args = [], extra = [], isCustom, methodNam
...
@@ -1824,7 +1830,7 @@ function processEventArgs (vm, event, args = [], extra = [], isCustom, methodNam
ret
.
push
(
event
.
target
.
value
);
ret
.
push
(
event
.
target
.
value
);
}
else
{
}
else
{
if
(
isCustom
&&
!
isCustomMPEvent
)
{
if
(
isCustom
&&
!
isCustomMPEvent
)
{
ret
.
push
(
event
.
detail
.
__args__
[
0
]);
ret
.
push
(
__args__
[
0
]);
}
else
{
// wxcomponent 组件或内置组件
}
else
{
// wxcomponent 组件或内置组件
ret
.
push
(
event
);
ret
.
push
(
event
);
}
}
...
...
packages/uni-mp-qq/dist/index.js
浏览文件 @
9c99f06a
...
@@ -1458,7 +1458,17 @@ const customize = cached((str) => {
...
@@ -1458,7 +1458,17 @@ const customize = cached((str) => {
function
initTriggerEvent
(
mpInstance
)
{
function
initTriggerEvent
(
mpInstance
)
{
const
oldTriggerEvent
=
mpInstance
.
triggerEvent
;
const
oldTriggerEvent
=
mpInstance
.
triggerEvent
;
const
newTriggerEvent
=
function
(
event
,
...
args
)
{
const
newTriggerEvent
=
function
(
event
,
...
args
)
{
return
oldTriggerEvent
.
apply
(
mpInstance
,
[
customize
(
event
),
...
args
])
// 事件名统一转驼峰格式,仅处理:当前组件为 vue 组件、当前组件为 vue 组件子组件
if
(
this
.
$vm
||
(
this
.
dataset
&&
this
.
dataset
.
comType
))
{
event
=
customize
(
event
);
}
else
{
// 针对微信/QQ小程序单独补充驼峰格式事件,以兼容历史项目
const
newEvent
=
customize
(
event
);
if
(
newEvent
!==
event
)
{
oldTriggerEvent
.
apply
(
this
,
[
newEvent
,
...
args
]);
}
}
return
oldTriggerEvent
.
apply
(
this
,
[
event
,
...
args
])
};
};
try
{
try
{
// 京东小程序 triggerEvent 为只读
// 京东小程序 triggerEvent 为只读
...
@@ -1630,7 +1640,7 @@ function initData (vueOptions, context) {
...
@@ -1630,7 +1640,7 @@ function initData (vueOptions, context) {
try
{
try
{
// 对 data 格式化
// 对 data 格式化
data
=
JSON
.
parse
(
JSON
.
stringify
(
data
));
data
=
JSON
.
parse
(
JSON
.
stringify
(
data
));
}
catch
(
e
)
{}
}
catch
(
e
)
{
}
}
}
if
(
!
isPlainObject
(
data
))
{
if
(
!
isPlainObject
(
data
))
{
...
@@ -1782,7 +1792,7 @@ function wrapper$1 (event) {
...
@@ -1782,7 +1792,7 @@ function wrapper$1 (event) {
// TODO 又得兼容 mpvue 的 mp 对象
// TODO 又得兼容 mpvue 的 mp 对象
try
{
try
{
event
.
mp
=
JSON
.
parse
(
JSON
.
stringify
(
event
));
event
.
mp
=
JSON
.
parse
(
JSON
.
stringify
(
event
));
}
catch
(
e
)
{}
}
catch
(
e
)
{
}
event
.
stopPropagation
=
noop
;
event
.
stopPropagation
=
noop
;
event
.
preventDefault
=
noop
;
event
.
preventDefault
=
noop
;
...
@@ -1853,7 +1863,7 @@ function getExtraValue (vm, dataPathsArray) {
...
@@ -1853,7 +1863,7 @@ function getExtraValue (vm, dataPathsArray) {
return
context
return
context
}
}
function
processEventExtra
(
vm
,
extra
,
event
)
{
function
processEventExtra
(
vm
,
extra
,
event
,
__args__
)
{
const
extraObj
=
{};
const
extraObj
=
{};
if
(
Array
.
isArray
(
extra
)
&&
extra
.
length
)
{
if
(
Array
.
isArray
(
extra
)
&&
extra
.
length
)
{
...
@@ -1876,11 +1886,7 @@ function processEventExtra (vm, extra, event) {
...
@@ -1876,11 +1886,7 @@ function processEventExtra (vm, extra, event) {
if
(
dataPath
===
'
$event
'
)
{
// $event
if
(
dataPath
===
'
$event
'
)
{
// $event
extraObj
[
'
$
'
+
index
]
=
event
;
extraObj
[
'
$
'
+
index
]
=
event
;
}
else
if
(
dataPath
===
'
arguments
'
)
{
}
else
if
(
dataPath
===
'
arguments
'
)
{
if
(
event
.
detail
&&
event
.
detail
.
__args__
)
{
extraObj
[
'
$
'
+
index
]
=
event
.
detail
?
event
.
detail
.
__args__
||
__args__
:
__args__
;
extraObj
[
'
$
'
+
index
]
=
event
.
detail
.
__args__
;
}
else
{
extraObj
[
'
$
'
+
index
]
=
[
event
];
}
}
else
if
(
dataPath
.
indexOf
(
'
$event.
'
)
===
0
)
{
// $event.target.value
}
else
if
(
dataPath
.
indexOf
(
'
$event.
'
)
===
0
)
{
// $event.target.value
extraObj
[
'
$
'
+
index
]
=
vm
.
__get_value
(
dataPath
.
replace
(
'
$event.
'
,
''
),
event
);
extraObj
[
'
$
'
+
index
]
=
vm
.
__get_value
(
dataPath
.
replace
(
'
$event.
'
,
''
),
event
);
}
else
{
}
else
{
...
@@ -1907,6 +1913,12 @@ function getObjByArray (arr) {
...
@@ -1907,6 +1913,12 @@ function getObjByArray (arr) {
function
processEventArgs
(
vm
,
event
,
args
=
[],
extra
=
[],
isCustom
,
methodName
)
{
function
processEventArgs
(
vm
,
event
,
args
=
[],
extra
=
[],
isCustom
,
methodName
)
{
let
isCustomMPEvent
=
false
;
// wxcomponent 组件,传递原始 event 对象
let
isCustomMPEvent
=
false
;
// wxcomponent 组件,传递原始 event 对象
// fixed 用户直接触发 mpInstance.triggerEvent
const
__args__
=
isPlainObject
(
event
.
detail
)
?
event
.
detail
.
__args__
||
[
event
.
detail
]
:
[
event
.
detail
];
if
(
isCustom
)
{
// 自定义事件
if
(
isCustom
)
{
// 自定义事件
isCustomMPEvent
=
event
.
currentTarget
&&
isCustomMPEvent
=
event
.
currentTarget
&&
event
.
currentTarget
.
dataset
&&
event
.
currentTarget
.
dataset
&&
...
@@ -1915,11 +1927,11 @@ function processEventArgs (vm, event, args = [], extra = [], isCustom, methodNam
...
@@ -1915,11 +1927,11 @@ function processEventArgs (vm, event, args = [], extra = [], isCustom, methodNam
if
(
isCustomMPEvent
)
{
if
(
isCustomMPEvent
)
{
return
[
event
]
return
[
event
]
}
}
return
event
.
detail
.
__args__
||
event
.
detail
return
__args__
}
}
}
}
const
extraObj
=
processEventExtra
(
vm
,
extra
,
event
);
const
extraObj
=
processEventExtra
(
vm
,
extra
,
event
,
__args__
);
const
ret
=
[];
const
ret
=
[];
args
.
forEach
(
arg
=>
{
args
.
forEach
(
arg
=>
{
...
@@ -1928,7 +1940,7 @@ function processEventArgs (vm, event, args = [], extra = [], isCustom, methodNam
...
@@ -1928,7 +1940,7 @@ function processEventArgs (vm, event, args = [], extra = [], isCustom, methodNam
ret
.
push
(
event
.
target
.
value
);
ret
.
push
(
event
.
target
.
value
);
}
else
{
}
else
{
if
(
isCustom
&&
!
isCustomMPEvent
)
{
if
(
isCustom
&&
!
isCustomMPEvent
)
{
ret
.
push
(
event
.
detail
.
__args__
[
0
]);
ret
.
push
(
__args__
[
0
]);
}
else
{
// wxcomponent 组件或内置组件
}
else
{
// wxcomponent 组件或内置组件
ret
.
push
(
event
);
ret
.
push
(
event
);
}
}
...
...
packages/uni-mp-toutiao/dist/index.js
浏览文件 @
9c99f06a
...
@@ -1550,7 +1550,11 @@ const customize = cached((str) => {
...
@@ -1550,7 +1550,11 @@ const customize = cached((str) => {
function
initTriggerEvent
(
mpInstance
)
{
function
initTriggerEvent
(
mpInstance
)
{
const
oldTriggerEvent
=
mpInstance
.
triggerEvent
;
const
oldTriggerEvent
=
mpInstance
.
triggerEvent
;
const
newTriggerEvent
=
function
(
event
,
...
args
)
{
const
newTriggerEvent
=
function
(
event
,
...
args
)
{
return
oldTriggerEvent
.
apply
(
mpInstance
,
[
customize
(
event
),
...
args
])
// 事件名统一转驼峰格式,仅处理:当前组件为 vue 组件、当前组件为 vue 组件子组件
if
(
this
.
$vm
||
(
this
.
dataset
&&
this
.
dataset
.
comType
))
{
event
=
customize
(
event
);
}
return
oldTriggerEvent
.
apply
(
this
,
[
event
,
...
args
])
};
};
try
{
try
{
// 京东小程序 triggerEvent 为只读
// 京东小程序 triggerEvent 为只读
...
@@ -1726,7 +1730,7 @@ function initData (vueOptions, context) {
...
@@ -1726,7 +1730,7 @@ function initData (vueOptions, context) {
try
{
try
{
// 对 data 格式化
// 对 data 格式化
data
=
JSON
.
parse
(
JSON
.
stringify
(
data
));
data
=
JSON
.
parse
(
JSON
.
stringify
(
data
));
}
catch
(
e
)
{}
}
catch
(
e
)
{
}
}
}
if
(
!
isPlainObject
(
data
))
{
if
(
!
isPlainObject
(
data
))
{
...
@@ -1885,7 +1889,7 @@ function wrapper$1 (event) {
...
@@ -1885,7 +1889,7 @@ function wrapper$1 (event) {
// TODO 又得兼容 mpvue 的 mp 对象
// TODO 又得兼容 mpvue 的 mp 对象
try
{
try
{
event
.
mp
=
JSON
.
parse
(
JSON
.
stringify
(
event
));
event
.
mp
=
JSON
.
parse
(
JSON
.
stringify
(
event
));
}
catch
(
e
)
{}
}
catch
(
e
)
{
}
event
.
stopPropagation
=
noop
;
event
.
stopPropagation
=
noop
;
event
.
preventDefault
=
noop
;
event
.
preventDefault
=
noop
;
...
@@ -1956,7 +1960,7 @@ function getExtraValue (vm, dataPathsArray) {
...
@@ -1956,7 +1960,7 @@ function getExtraValue (vm, dataPathsArray) {
return
context
return
context
}
}
function
processEventExtra
(
vm
,
extra
,
event
)
{
function
processEventExtra
(
vm
,
extra
,
event
,
__args__
)
{
const
extraObj
=
{};
const
extraObj
=
{};
if
(
Array
.
isArray
(
extra
)
&&
extra
.
length
)
{
if
(
Array
.
isArray
(
extra
)
&&
extra
.
length
)
{
...
@@ -1979,11 +1983,7 @@ function processEventExtra (vm, extra, event) {
...
@@ -1979,11 +1983,7 @@ function processEventExtra (vm, extra, event) {
if
(
dataPath
===
'
$event
'
)
{
// $event
if
(
dataPath
===
'
$event
'
)
{
// $event
extraObj
[
'
$
'
+
index
]
=
event
;
extraObj
[
'
$
'
+
index
]
=
event
;
}
else
if
(
dataPath
===
'
arguments
'
)
{
}
else
if
(
dataPath
===
'
arguments
'
)
{
if
(
event
.
detail
&&
event
.
detail
.
__args__
)
{
extraObj
[
'
$
'
+
index
]
=
event
.
detail
?
event
.
detail
.
__args__
||
__args__
:
__args__
;
extraObj
[
'
$
'
+
index
]
=
event
.
detail
.
__args__
;
}
else
{
extraObj
[
'
$
'
+
index
]
=
[
event
];
}
}
else
if
(
dataPath
.
indexOf
(
'
$event.
'
)
===
0
)
{
// $event.target.value
}
else
if
(
dataPath
.
indexOf
(
'
$event.
'
)
===
0
)
{
// $event.target.value
extraObj
[
'
$
'
+
index
]
=
vm
.
__get_value
(
dataPath
.
replace
(
'
$event.
'
,
''
),
event
);
extraObj
[
'
$
'
+
index
]
=
vm
.
__get_value
(
dataPath
.
replace
(
'
$event.
'
,
''
),
event
);
}
else
{
}
else
{
...
@@ -2010,6 +2010,12 @@ function getObjByArray (arr) {
...
@@ -2010,6 +2010,12 @@ function getObjByArray (arr) {
function
processEventArgs
(
vm
,
event
,
args
=
[],
extra
=
[],
isCustom
,
methodName
)
{
function
processEventArgs
(
vm
,
event
,
args
=
[],
extra
=
[],
isCustom
,
methodName
)
{
let
isCustomMPEvent
=
false
;
// wxcomponent 组件,传递原始 event 对象
let
isCustomMPEvent
=
false
;
// wxcomponent 组件,传递原始 event 对象
// fixed 用户直接触发 mpInstance.triggerEvent
const
__args__
=
isPlainObject
(
event
.
detail
)
?
event
.
detail
.
__args__
||
[
event
.
detail
]
:
[
event
.
detail
];
if
(
isCustom
)
{
// 自定义事件
if
(
isCustom
)
{
// 自定义事件
isCustomMPEvent
=
event
.
currentTarget
&&
isCustomMPEvent
=
event
.
currentTarget
&&
event
.
currentTarget
.
dataset
&&
event
.
currentTarget
.
dataset
&&
...
@@ -2018,11 +2024,11 @@ function processEventArgs (vm, event, args = [], extra = [], isCustom, methodNam
...
@@ -2018,11 +2024,11 @@ function processEventArgs (vm, event, args = [], extra = [], isCustom, methodNam
if
(
isCustomMPEvent
)
{
if
(
isCustomMPEvent
)
{
return
[
event
]
return
[
event
]
}
}
return
event
.
detail
.
__args__
||
event
.
detail
return
__args__
}
}
}
}
const
extraObj
=
processEventExtra
(
vm
,
extra
,
event
);
const
extraObj
=
processEventExtra
(
vm
,
extra
,
event
,
__args__
);
const
ret
=
[];
const
ret
=
[];
args
.
forEach
(
arg
=>
{
args
.
forEach
(
arg
=>
{
...
@@ -2031,7 +2037,7 @@ function processEventArgs (vm, event, args = [], extra = [], isCustom, methodNam
...
@@ -2031,7 +2037,7 @@ function processEventArgs (vm, event, args = [], extra = [], isCustom, methodNam
ret
.
push
(
event
.
target
.
value
);
ret
.
push
(
event
.
target
.
value
);
}
else
{
}
else
{
if
(
isCustom
&&
!
isCustomMPEvent
)
{
if
(
isCustom
&&
!
isCustomMPEvent
)
{
ret
.
push
(
event
.
detail
.
__args__
[
0
]);
ret
.
push
(
__args__
[
0
]);
}
else
{
// wxcomponent 组件或内置组件
}
else
{
// wxcomponent 组件或内置组件
ret
.
push
(
event
);
ret
.
push
(
event
);
}
}
...
...
packages/uni-mp-weixin/dist/index.js
浏览文件 @
9c99f06a
...
@@ -1280,7 +1280,17 @@ const customize = cached((str) => {
...
@@ -1280,7 +1280,17 @@ const customize = cached((str) => {
function
initTriggerEvent
(
mpInstance
)
{
function
initTriggerEvent
(
mpInstance
)
{
const
oldTriggerEvent
=
mpInstance
.
triggerEvent
;
const
oldTriggerEvent
=
mpInstance
.
triggerEvent
;
const
newTriggerEvent
=
function
(
event
,
...
args
)
{
const
newTriggerEvent
=
function
(
event
,
...
args
)
{
return
oldTriggerEvent
.
apply
(
mpInstance
,
[
customize
(
event
),
...
args
])
// 事件名统一转驼峰格式,仅处理:当前组件为 vue 组件、当前组件为 vue 组件子组件
if
(
this
.
$vm
||
(
this
.
dataset
&&
this
.
dataset
.
comType
))
{
event
=
customize
(
event
);
}
else
{
// 针对微信/QQ小程序单独补充驼峰格式事件,以兼容历史项目
const
newEvent
=
customize
(
event
);
if
(
newEvent
!==
event
)
{
oldTriggerEvent
.
apply
(
this
,
[
newEvent
,
...
args
]);
}
}
return
oldTriggerEvent
.
apply
(
this
,
[
event
,
...
args
])
};
};
try
{
try
{
// 京东小程序 triggerEvent 为只读
// 京东小程序 triggerEvent 为只读
...
@@ -1452,7 +1462,7 @@ function initData (vueOptions, context) {
...
@@ -1452,7 +1462,7 @@ function initData (vueOptions, context) {
try
{
try
{
// 对 data 格式化
// 对 data 格式化
data
=
JSON
.
parse
(
JSON
.
stringify
(
data
));
data
=
JSON
.
parse
(
JSON
.
stringify
(
data
));
}
catch
(
e
)
{}
}
catch
(
e
)
{
}
}
}
if
(
!
isPlainObject
(
data
))
{
if
(
!
isPlainObject
(
data
))
{
...
@@ -1616,7 +1626,7 @@ function wrapper$1 (event) {
...
@@ -1616,7 +1626,7 @@ function wrapper$1 (event) {
// TODO 又得兼容 mpvue 的 mp 对象
// TODO 又得兼容 mpvue 的 mp 对象
try
{
try
{
event
.
mp
=
JSON
.
parse
(
JSON
.
stringify
(
event
));
event
.
mp
=
JSON
.
parse
(
JSON
.
stringify
(
event
));
}
catch
(
e
)
{}
}
catch
(
e
)
{
}
event
.
stopPropagation
=
noop
;
event
.
stopPropagation
=
noop
;
event
.
preventDefault
=
noop
;
event
.
preventDefault
=
noop
;
...
@@ -1687,7 +1697,7 @@ function getExtraValue (vm, dataPathsArray) {
...
@@ -1687,7 +1697,7 @@ function getExtraValue (vm, dataPathsArray) {
return
context
return
context
}
}
function
processEventExtra
(
vm
,
extra
,
event
)
{
function
processEventExtra
(
vm
,
extra
,
event
,
__args__
)
{
const
extraObj
=
{};
const
extraObj
=
{};
if
(
Array
.
isArray
(
extra
)
&&
extra
.
length
)
{
if
(
Array
.
isArray
(
extra
)
&&
extra
.
length
)
{
...
@@ -1710,11 +1720,7 @@ function processEventExtra (vm, extra, event) {
...
@@ -1710,11 +1720,7 @@ function processEventExtra (vm, extra, event) {
if
(
dataPath
===
'
$event
'
)
{
// $event
if
(
dataPath
===
'
$event
'
)
{
// $event
extraObj
[
'
$
'
+
index
]
=
event
;
extraObj
[
'
$
'
+
index
]
=
event
;
}
else
if
(
dataPath
===
'
arguments
'
)
{
}
else
if
(
dataPath
===
'
arguments
'
)
{
if
(
event
.
detail
&&
event
.
detail
.
__args__
)
{
extraObj
[
'
$
'
+
index
]
=
event
.
detail
?
event
.
detail
.
__args__
||
__args__
:
__args__
;
extraObj
[
'
$
'
+
index
]
=
event
.
detail
.
__args__
;
}
else
{
extraObj
[
'
$
'
+
index
]
=
[
event
];
}
}
else
if
(
dataPath
.
indexOf
(
'
$event.
'
)
===
0
)
{
// $event.target.value
}
else
if
(
dataPath
.
indexOf
(
'
$event.
'
)
===
0
)
{
// $event.target.value
extraObj
[
'
$
'
+
index
]
=
vm
.
__get_value
(
dataPath
.
replace
(
'
$event.
'
,
''
),
event
);
extraObj
[
'
$
'
+
index
]
=
vm
.
__get_value
(
dataPath
.
replace
(
'
$event.
'
,
''
),
event
);
}
else
{
}
else
{
...
@@ -1741,6 +1747,12 @@ function getObjByArray (arr) {
...
@@ -1741,6 +1747,12 @@ function getObjByArray (arr) {
function
processEventArgs
(
vm
,
event
,
args
=
[],
extra
=
[],
isCustom
,
methodName
)
{
function
processEventArgs
(
vm
,
event
,
args
=
[],
extra
=
[],
isCustom
,
methodName
)
{
let
isCustomMPEvent
=
false
;
// wxcomponent 组件,传递原始 event 对象
let
isCustomMPEvent
=
false
;
// wxcomponent 组件,传递原始 event 对象
// fixed 用户直接触发 mpInstance.triggerEvent
const
__args__
=
isPlainObject
(
event
.
detail
)
?
event
.
detail
.
__args__
||
[
event
.
detail
]
:
[
event
.
detail
];
if
(
isCustom
)
{
// 自定义事件
if
(
isCustom
)
{
// 自定义事件
isCustomMPEvent
=
event
.
currentTarget
&&
isCustomMPEvent
=
event
.
currentTarget
&&
event
.
currentTarget
.
dataset
&&
event
.
currentTarget
.
dataset
&&
...
@@ -1749,11 +1761,11 @@ function processEventArgs (vm, event, args = [], extra = [], isCustom, methodNam
...
@@ -1749,11 +1761,11 @@ function processEventArgs (vm, event, args = [], extra = [], isCustom, methodNam
if
(
isCustomMPEvent
)
{
if
(
isCustomMPEvent
)
{
return
[
event
]
return
[
event
]
}
}
return
event
.
detail
.
__args__
||
event
.
detail
return
__args__
}
}
}
}
const
extraObj
=
processEventExtra
(
vm
,
extra
,
event
);
const
extraObj
=
processEventExtra
(
vm
,
extra
,
event
,
__args__
);
const
ret
=
[];
const
ret
=
[];
args
.
forEach
(
arg
=>
{
args
.
forEach
(
arg
=>
{
...
@@ -1762,7 +1774,7 @@ function processEventArgs (vm, event, args = [], extra = [], isCustom, methodNam
...
@@ -1762,7 +1774,7 @@ function processEventArgs (vm, event, args = [], extra = [], isCustom, methodNam
ret
.
push
(
event
.
target
.
value
);
ret
.
push
(
event
.
target
.
value
);
}
else
{
}
else
{
if
(
isCustom
&&
!
isCustomMPEvent
)
{
if
(
isCustom
&&
!
isCustomMPEvent
)
{
ret
.
push
(
event
.
detail
.
__args__
[
0
]);
ret
.
push
(
__args__
[
0
]);
}
else
{
// wxcomponent 组件或内置组件
}
else
{
// wxcomponent 组件或内置组件
ret
.
push
(
event
);
ret
.
push
(
event
);
}
}
...
...
packages/uni-mp-xhs/dist/index.js
浏览文件 @
9c99f06a
...
@@ -1127,7 +1127,11 @@ const customize = cached((str) => {
...
@@ -1127,7 +1127,11 @@ const customize = cached((str) => {
function
initTriggerEvent
(
mpInstance
)
{
function
initTriggerEvent
(
mpInstance
)
{
const
oldTriggerEvent
=
mpInstance
.
triggerEvent
;
const
oldTriggerEvent
=
mpInstance
.
triggerEvent
;
const
newTriggerEvent
=
function
(
event
,
...
args
)
{
const
newTriggerEvent
=
function
(
event
,
...
args
)
{
return
oldTriggerEvent
.
apply
(
mpInstance
,
[
customize
(
event
),
...
args
])
// 事件名统一转驼峰格式,仅处理:当前组件为 vue 组件、当前组件为 vue 组件子组件
if
(
this
.
$vm
||
(
this
.
dataset
&&
this
.
dataset
.
comType
))
{
event
=
customize
(
event
);
}
return
oldTriggerEvent
.
apply
(
this
,
[
event
,
...
args
])
};
};
try
{
try
{
// 京东小程序 triggerEvent 为只读
// 京东小程序 triggerEvent 为只读
...
@@ -1299,7 +1303,7 @@ function initData (vueOptions, context) {
...
@@ -1299,7 +1303,7 @@ function initData (vueOptions, context) {
try
{
try
{
// 对 data 格式化
// 对 data 格式化
data
=
JSON
.
parse
(
JSON
.
stringify
(
data
));
data
=
JSON
.
parse
(
JSON
.
stringify
(
data
));
}
catch
(
e
)
{}
}
catch
(
e
)
{
}
}
}
if
(
!
isPlainObject
(
data
))
{
if
(
!
isPlainObject
(
data
))
{
...
@@ -1451,7 +1455,7 @@ function wrapper$1 (event) {
...
@@ -1451,7 +1455,7 @@ function wrapper$1 (event) {
// TODO 又得兼容 mpvue 的 mp 对象
// TODO 又得兼容 mpvue 的 mp 对象
try
{
try
{
event
.
mp
=
JSON
.
parse
(
JSON
.
stringify
(
event
));
event
.
mp
=
JSON
.
parse
(
JSON
.
stringify
(
event
));
}
catch
(
e
)
{}
}
catch
(
e
)
{
}
event
.
stopPropagation
=
noop
;
event
.
stopPropagation
=
noop
;
event
.
preventDefault
=
noop
;
event
.
preventDefault
=
noop
;
...
@@ -1522,7 +1526,7 @@ function getExtraValue (vm, dataPathsArray) {
...
@@ -1522,7 +1526,7 @@ function getExtraValue (vm, dataPathsArray) {
return
context
return
context
}
}
function
processEventExtra
(
vm
,
extra
,
event
)
{
function
processEventExtra
(
vm
,
extra
,
event
,
__args__
)
{
const
extraObj
=
{};
const
extraObj
=
{};
if
(
Array
.
isArray
(
extra
)
&&
extra
.
length
)
{
if
(
Array
.
isArray
(
extra
)
&&
extra
.
length
)
{
...
@@ -1545,11 +1549,7 @@ function processEventExtra (vm, extra, event) {
...
@@ -1545,11 +1549,7 @@ function processEventExtra (vm, extra, event) {
if
(
dataPath
===
'
$event
'
)
{
// $event
if
(
dataPath
===
'
$event
'
)
{
// $event
extraObj
[
'
$
'
+
index
]
=
event
;
extraObj
[
'
$
'
+
index
]
=
event
;
}
else
if
(
dataPath
===
'
arguments
'
)
{
}
else
if
(
dataPath
===
'
arguments
'
)
{
if
(
event
.
detail
&&
event
.
detail
.
__args__
)
{
extraObj
[
'
$
'
+
index
]
=
event
.
detail
?
event
.
detail
.
__args__
||
__args__
:
__args__
;
extraObj
[
'
$
'
+
index
]
=
event
.
detail
.
__args__
;
}
else
{
extraObj
[
'
$
'
+
index
]
=
[
event
];
}
}
else
if
(
dataPath
.
indexOf
(
'
$event.
'
)
===
0
)
{
// $event.target.value
}
else
if
(
dataPath
.
indexOf
(
'
$event.
'
)
===
0
)
{
// $event.target.value
extraObj
[
'
$
'
+
index
]
=
vm
.
__get_value
(
dataPath
.
replace
(
'
$event.
'
,
''
),
event
);
extraObj
[
'
$
'
+
index
]
=
vm
.
__get_value
(
dataPath
.
replace
(
'
$event.
'
,
''
),
event
);
}
else
{
}
else
{
...
@@ -1576,6 +1576,12 @@ function getObjByArray (arr) {
...
@@ -1576,6 +1576,12 @@ function getObjByArray (arr) {
function
processEventArgs
(
vm
,
event
,
args
=
[],
extra
=
[],
isCustom
,
methodName
)
{
function
processEventArgs
(
vm
,
event
,
args
=
[],
extra
=
[],
isCustom
,
methodName
)
{
let
isCustomMPEvent
=
false
;
// wxcomponent 组件,传递原始 event 对象
let
isCustomMPEvent
=
false
;
// wxcomponent 组件,传递原始 event 对象
// fixed 用户直接触发 mpInstance.triggerEvent
const
__args__
=
isPlainObject
(
event
.
detail
)
?
event
.
detail
.
__args__
||
[
event
.
detail
]
:
[
event
.
detail
];
if
(
isCustom
)
{
// 自定义事件
if
(
isCustom
)
{
// 自定义事件
isCustomMPEvent
=
event
.
currentTarget
&&
isCustomMPEvent
=
event
.
currentTarget
&&
event
.
currentTarget
.
dataset
&&
event
.
currentTarget
.
dataset
&&
...
@@ -1584,11 +1590,11 @@ function processEventArgs (vm, event, args = [], extra = [], isCustom, methodNam
...
@@ -1584,11 +1590,11 @@ function processEventArgs (vm, event, args = [], extra = [], isCustom, methodNam
if
(
isCustomMPEvent
)
{
if
(
isCustomMPEvent
)
{
return
[
event
]
return
[
event
]
}
}
return
event
.
detail
.
__args__
||
event
.
detail
return
__args__
}
}
}
}
const
extraObj
=
processEventExtra
(
vm
,
extra
,
event
);
const
extraObj
=
processEventExtra
(
vm
,
extra
,
event
,
__args__
);
const
ret
=
[];
const
ret
=
[];
args
.
forEach
(
arg
=>
{
args
.
forEach
(
arg
=>
{
...
@@ -1597,7 +1603,7 @@ function processEventArgs (vm, event, args = [], extra = [], isCustom, methodNam
...
@@ -1597,7 +1603,7 @@ function processEventArgs (vm, event, args = [], extra = [], isCustom, methodNam
ret
.
push
(
event
.
target
.
value
);
ret
.
push
(
event
.
target
.
value
);
}
else
{
}
else
{
if
(
isCustom
&&
!
isCustomMPEvent
)
{
if
(
isCustom
&&
!
isCustomMPEvent
)
{
ret
.
push
(
event
.
detail
.
__args__
[
0
]);
ret
.
push
(
__args__
[
0
]);
}
else
{
// wxcomponent 组件或内置组件
}
else
{
// wxcomponent 组件或内置组件
ret
.
push
(
event
);
ret
.
push
(
event
);
}
}
...
...
packages/uni-quickapp-webview/dist/index.js
浏览文件 @
9c99f06a
...
@@ -1298,7 +1298,11 @@ const customize = cached((str) => {
...
@@ -1298,7 +1298,11 @@ const customize = cached((str) => {
function
initTriggerEvent
(
mpInstance
)
{
function
initTriggerEvent
(
mpInstance
)
{
const
oldTriggerEvent
=
mpInstance
.
triggerEvent
;
const
oldTriggerEvent
=
mpInstance
.
triggerEvent
;
const
newTriggerEvent
=
function
(
event
,
...
args
)
{
const
newTriggerEvent
=
function
(
event
,
...
args
)
{
return
oldTriggerEvent
.
apply
(
mpInstance
,
[
customize
(
event
),
...
args
])
// 事件名统一转驼峰格式,仅处理:当前组件为 vue 组件、当前组件为 vue 组件子组件
if
(
this
.
$vm
||
(
this
.
dataset
&&
this
.
dataset
.
comType
))
{
event
=
customize
(
event
);
}
return
oldTriggerEvent
.
apply
(
this
,
[
event
,
...
args
])
};
};
try
{
try
{
// 京东小程序 triggerEvent 为只读
// 京东小程序 triggerEvent 为只读
...
@@ -1470,7 +1474,7 @@ function initData (vueOptions, context) {
...
@@ -1470,7 +1474,7 @@ function initData (vueOptions, context) {
try
{
try
{
// 对 data 格式化
// 对 data 格式化
data
=
JSON
.
parse
(
JSON
.
stringify
(
data
));
data
=
JSON
.
parse
(
JSON
.
stringify
(
data
));
}
catch
(
e
)
{}
}
catch
(
e
)
{
}
}
}
if
(
!
isPlainObject
(
data
))
{
if
(
!
isPlainObject
(
data
))
{
...
@@ -1622,7 +1626,7 @@ function wrapper$1 (event) {
...
@@ -1622,7 +1626,7 @@ function wrapper$1 (event) {
// TODO 又得兼容 mpvue 的 mp 对象
// TODO 又得兼容 mpvue 的 mp 对象
try
{
try
{
event
.
mp
=
JSON
.
parse
(
JSON
.
stringify
(
event
));
event
.
mp
=
JSON
.
parse
(
JSON
.
stringify
(
event
));
}
catch
(
e
)
{}
}
catch
(
e
)
{
}
event
.
stopPropagation
=
noop
;
event
.
stopPropagation
=
noop
;
event
.
preventDefault
=
noop
;
event
.
preventDefault
=
noop
;
...
@@ -1693,7 +1697,7 @@ function getExtraValue (vm, dataPathsArray) {
...
@@ -1693,7 +1697,7 @@ function getExtraValue (vm, dataPathsArray) {
return
context
return
context
}
}
function
processEventExtra
(
vm
,
extra
,
event
)
{
function
processEventExtra
(
vm
,
extra
,
event
,
__args__
)
{
const
extraObj
=
{};
const
extraObj
=
{};
if
(
Array
.
isArray
(
extra
)
&&
extra
.
length
)
{
if
(
Array
.
isArray
(
extra
)
&&
extra
.
length
)
{
...
@@ -1716,11 +1720,7 @@ function processEventExtra (vm, extra, event) {
...
@@ -1716,11 +1720,7 @@ function processEventExtra (vm, extra, event) {
if
(
dataPath
===
'
$event
'
)
{
// $event
if
(
dataPath
===
'
$event
'
)
{
// $event
extraObj
[
'
$
'
+
index
]
=
event
;
extraObj
[
'
$
'
+
index
]
=
event
;
}
else
if
(
dataPath
===
'
arguments
'
)
{
}
else
if
(
dataPath
===
'
arguments
'
)
{
if
(
event
.
detail
&&
event
.
detail
.
__args__
)
{
extraObj
[
'
$
'
+
index
]
=
event
.
detail
?
event
.
detail
.
__args__
||
__args__
:
__args__
;
extraObj
[
'
$
'
+
index
]
=
event
.
detail
.
__args__
;
}
else
{
extraObj
[
'
$
'
+
index
]
=
[
event
];
}
}
else
if
(
dataPath
.
indexOf
(
'
$event.
'
)
===
0
)
{
// $event.target.value
}
else
if
(
dataPath
.
indexOf
(
'
$event.
'
)
===
0
)
{
// $event.target.value
extraObj
[
'
$
'
+
index
]
=
vm
.
__get_value
(
dataPath
.
replace
(
'
$event.
'
,
''
),
event
);
extraObj
[
'
$
'
+
index
]
=
vm
.
__get_value
(
dataPath
.
replace
(
'
$event.
'
,
''
),
event
);
}
else
{
}
else
{
...
@@ -1747,6 +1747,12 @@ function getObjByArray (arr) {
...
@@ -1747,6 +1747,12 @@ function getObjByArray (arr) {
function
processEventArgs
(
vm
,
event
,
args
=
[],
extra
=
[],
isCustom
,
methodName
)
{
function
processEventArgs
(
vm
,
event
,
args
=
[],
extra
=
[],
isCustom
,
methodName
)
{
let
isCustomMPEvent
=
false
;
// wxcomponent 组件,传递原始 event 对象
let
isCustomMPEvent
=
false
;
// wxcomponent 组件,传递原始 event 对象
// fixed 用户直接触发 mpInstance.triggerEvent
const
__args__
=
isPlainObject
(
event
.
detail
)
?
event
.
detail
.
__args__
||
[
event
.
detail
]
:
[
event
.
detail
];
if
(
isCustom
)
{
// 自定义事件
if
(
isCustom
)
{
// 自定义事件
isCustomMPEvent
=
event
.
currentTarget
&&
isCustomMPEvent
=
event
.
currentTarget
&&
event
.
currentTarget
.
dataset
&&
event
.
currentTarget
.
dataset
&&
...
@@ -1755,11 +1761,11 @@ function processEventArgs (vm, event, args = [], extra = [], isCustom, methodNam
...
@@ -1755,11 +1761,11 @@ function processEventArgs (vm, event, args = [], extra = [], isCustom, methodNam
if
(
isCustomMPEvent
)
{
if
(
isCustomMPEvent
)
{
return
[
event
]
return
[
event
]
}
}
return
event
.
detail
.
__args__
||
event
.
detail
return
__args__
}
}
}
}
const
extraObj
=
processEventExtra
(
vm
,
extra
,
event
);
const
extraObj
=
processEventExtra
(
vm
,
extra
,
event
,
__args__
);
const
ret
=
[];
const
ret
=
[];
args
.
forEach
(
arg
=>
{
args
.
forEach
(
arg
=>
{
...
@@ -1768,7 +1774,7 @@ function processEventArgs (vm, event, args = [], extra = [], isCustom, methodNam
...
@@ -1768,7 +1774,7 @@ function processEventArgs (vm, event, args = [], extra = [], isCustom, methodNam
ret
.
push
(
event
.
target
.
value
);
ret
.
push
(
event
.
target
.
value
);
}
else
{
}
else
{
if
(
isCustom
&&
!
isCustomMPEvent
)
{
if
(
isCustom
&&
!
isCustomMPEvent
)
{
ret
.
push
(
event
.
detail
.
__args__
[
0
]);
ret
.
push
(
__args__
[
0
]);
}
else
{
// wxcomponent 组件或内置组件
}
else
{
// wxcomponent 组件或内置组件
ret
.
push
(
event
);
ret
.
push
(
event
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录