提交 72f0e681 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

wip(uts): automator touchEvent

上级 c6acac28
......@@ -436,8 +436,8 @@ export const captureScreenshot = (
const currentPage = _getCurrentPage()
if (currentPage != null) {
currentPage.$viewToTempFilePath({
id: params.fullPage === true ? null : params.id,
wholeContent: params.fullPage === true,
id: params.fullPage == true ? null : params.id,
wholeContent: params.fullPage == true,
path: params.path,
success: (res) => {
// @ts-ignore
......
......@@ -350,13 +350,13 @@ export type HandleTouchEventParams = {
pageId: string
elementId?: string | null
nodeId?: number | null
eventName: string
touches: any[]
changedTouches: any[]
}
export const handleTouchEvent = (
params: HandleTouchEventParams,
eventName: string,
callback: Callback
): void => {
const dom = getElementByIdOrNodeId(
......@@ -369,11 +369,11 @@ export const handleTouchEvent = (
const touches = getTouches(params.touches)
const changedTouches = getTouches(params.changedTouches)
dom.dispatchEvent(
params.eventName,
eventName,
// @ts-ignore
TouchEvent(null, params.eventName, touches, changedTouches)
TouchEvent(null, eventName, touches, changedTouches)
)
callback({ result: `Element.${params.eventName} success` }, null)
callback({ result: `Element.${eventName} success` }, null)
}
}
......
......@@ -182,9 +182,7 @@ export function onMessage(msg: string) {
case 'Element.touchmove':
case 'Element.touchend':
// @ts-ignore
const _params = JSON.parse<HandleTouchEventParams>(params)!
_params.eventName = method.split('.')[1]
handleTouchEvent(_params, callback)
handleTouchEvent(JSON.parse<HandleTouchEventParams>(params)!, method.split('.')[1], callback)
break
case 'Element.getAttributes':
// @ts-ignore
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册