Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
6ff35a2d
U
uni-app
项目概览
DCloud
/
uni-app
14 天 前同步成功
通知
751
Star
38709
Fork
3642
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
8
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
8
Issue
8
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
6ff35a2d
编写于
2月 14, 2023
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(mp-weixin): skyline gesture (question/162700)
上级
df31427b
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
69 addition
and
1 deletion
+69
-1
packages/uni-mp-core/src/runtime/component.ts
packages/uni-mp-core/src/runtime/component.ts
+11
-1
packages/uni-mp-core/src/runtime/util.ts
packages/uni-mp-core/src/runtime/util.ts
+17
-0
packages/uni-mp-weixin/__tests__/component.spec.ts
packages/uni-mp-weixin/__tests__/component.spec.ts
+9
-0
packages/uni-mp-weixin/dist/uni.compiler.js
packages/uni-mp-weixin/dist/uni.compiler.js
+8
-0
packages/uni-mp-weixin/dist/uni.mp.esm.js
packages/uni-mp-weixin/dist/uni.mp.esm.js
+16
-0
packages/uni-mp-weixin/src/compiler/options.ts
packages/uni-mp-weixin/src/compiler/options.ts
+8
-0
未找到文件。
packages/uni-mp-core/src/runtime/component.ts
浏览文件 @
6ff35a2d
...
...
@@ -9,7 +9,11 @@ import {
// @ts-expect-error
import
{
getExposeProxy
}
from
'
vue
'
import
{
initExtraOptions
,
initWxsCallMethods
}
from
'
./util
'
import
{
initExtraOptions
,
initWorkletMethods
,
initWxsCallMethods
,
}
from
'
./util
'
import
{
initProps
}
from
'
./componentProps
'
import
{
applyOptions
,
initPropsObserver
}
from
'
./componentOptions
'
...
...
@@ -138,6 +142,12 @@ export function parseComponent(
mpComponentOptions
.
methods
as
Component
.
MethodOption
,
vueOptions
.
wxsCallMethods
)
if
(
__PLATFORM__
===
'
mp-weixin
'
)
{
initWorkletMethods
(
mpComponentOptions
.
methods
as
Component
.
MethodOption
,
vueOptions
.
methods
)
}
if
(
parse
)
{
parse
(
mpComponentOptions
,
{
handleLink
})
...
...
packages/uni-mp-core/src/runtime/util.ts
浏览文件 @
6ff35a2d
...
...
@@ -39,6 +39,23 @@ export function initExtraOptions(
})
}
const
WORKLET_RE
=
/_
(
.*
)
_worklet_factory_/
export
function
initWorkletMethods
(
mpMethods
:
WechatMiniprogram
.
Component
.
MethodOption
,
vueMethods
:
ComponentOptions
[
'
methods
'
]
)
{
if
(
vueMethods
)
{
Object
.
keys
(
vueMethods
).
forEach
((
name
)
=>
{
const
matches
=
name
.
match
(
WORKLET_RE
)
if
(
matches
)
{
const
workletName
=
matches
[
1
]
mpMethods
[
name
]
=
vueMethods
[
name
]
mpMethods
[
workletName
]
=
vueMethods
[
workletName
]
}
})
}
}
export
function
initWxsCallMethods
(
methods
:
WechatMiniprogram
.
Component
.
MethodOption
,
wxsCallMethods
:
WechatMiniprogram
.
Component
.
MethodOption
...
...
packages/uni-mp-weixin/__tests__/component.spec.ts
浏览文件 @
6ff35a2d
...
...
@@ -225,6 +225,15 @@ describe('mp-weixin: transform component', () => {
`<block wx:if="{{r0}}"><scroll-view binddragstart="{{a}}" binddragging="{{b}}" binddragend="{{c}}"/></block>`
,
`(_ctx, _cache) => {
return { a: _o(_ctx.d), b: _o(_ctx.d), c: _o(_ctx.d) }
}`
)
})
test
(
`skyline gesture`
,
()
=>
{
assert
(
`<vertical-drag-gesture-handler onGestureEvent="handlePan" native-view="scroll-view" shouldResponseOnMove="shouldResponse" shouldAcceptGesture="shouldAccept"/>`
,
`<vertical-drag-gesture-handler onGestureEvent="handlePan" native-view="scroll-view" shouldResponseOnMove="shouldResponse" shouldAcceptGesture="shouldAccept"/>`
,
`(_ctx, _cache) => {
return {}
}`
)
})
...
...
packages/uni-mp-weixin/dist/uni.compiler.js
浏览文件 @
6ff35a2d
...
...
@@ -118,6 +118,14 @@ const customElements = [
'
navigation-bar
'
,
'
match-media
'
,
'
ad-custom
'
,
// 手势组件
'
tap-gesture-handler
'
,
'
double-tap-gesture-handler
'
,
'
pan-gesture-handler
'
,
'
scale-gesture-handler
'
,
'
force-press-gesture-handler
'
,
'
vertical-drag-gesture-handler
'
,
'
horizontal-drag-gesture-handler
'
,
];
const
compilerOptions
=
{
nodeTransforms
:
[
uniCliShared
.
transformRef
,
uniCliShared
.
transformComponentLink
,
transformAd
],
...
...
packages/uni-mp-weixin/dist/uni.mp.esm.js
浏览文件 @
6ff35a2d
...
...
@@ -308,6 +308,19 @@ function initExtraOptions(miniProgramComponentOptions, vueOptions) {
}
});
}
const
WORKLET_RE
=
/_
(
.*
)
_worklet_factory_/
;
function
initWorkletMethods
(
mpMethods
,
vueMethods
)
{
if
(
vueMethods
)
{
Object
.
keys
(
vueMethods
).
forEach
((
name
)
=>
{
const
matches
=
name
.
match
(
WORKLET_RE
);
if
(
matches
)
{
const
workletName
=
matches
[
1
];
mpMethods
[
name
]
=
vueMethods
[
name
];
mpMethods
[
workletName
]
=
vueMethods
[
workletName
];
}
});
}
}
function
initWxsCallMethods
(
methods
,
wxsCallMethods
)
{
if
(
!
isArray
(
wxsCallMethods
))
{
return
;
...
...
@@ -671,6 +684,9 @@ function parseComponent(vueOptions, { parse, mocks, isPage, initRelation, handle
initPropsObserver
(
mpComponentOptions
);
initExtraOptions
(
mpComponentOptions
,
vueOptions
);
initWxsCallMethods
(
mpComponentOptions
.
methods
,
vueOptions
.
wxsCallMethods
);
{
initWorkletMethods
(
mpComponentOptions
.
methods
,
vueOptions
.
methods
);
}
if
(
parse
)
{
parse
(
mpComponentOptions
,
{
handleLink
});
}
...
...
packages/uni-mp-weixin/src/compiler/options.ts
浏览文件 @
6ff35a2d
...
...
@@ -19,6 +19,14 @@ export const customElements = [
'
navigation-bar
'
,
'
match-media
'
,
'
ad-custom
'
,
// 手势组件
'
tap-gesture-handler
'
,
'
double-tap-gesture-handler
'
,
'
pan-gesture-handler
'
,
'
scale-gesture-handler
'
,
'
force-press-gesture-handler
'
,
'
vertical-drag-gesture-handler
'
,
'
horizontal-drag-gesture-handler
'
,
]
export
const
compilerOptions
:
CompilerOptions
=
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录