Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
兴科Sinco
uni-app
提交
54686c68
U
uni-app
项目概览
兴科Sinco
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
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,体验更适合开发者的 AI 搜索 >>
提交
54686c68
编写于
2月 15, 2023
作者:
DCloud-WZF
💬
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(mp-weixin): skyline gesture (question/162700)
上级
3a9801a7
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
87 addition
and
8 deletion
+87
-8
packages/uni-mp-weixin/dist/index.js
packages/uni-mp-weixin/dist/index.js
+32
-2
packages/uni-template-compiler/__tests__/compiler-mp-weixin.spec.js
...ni-template-compiler/__tests__/compiler-mp-weixin.spec.js
+7
-0
packages/uni-template-compiler/lib/mp.js
packages/uni-template-compiler/lib/mp.js
+10
-2
packages/webpack-uni-pages-loader/lib/platforms/mp.js
packages/webpack-uni-pages-loader/lib/platforms/mp.js
+18
-2
src/platforms/app-plus/service/api/index.js
src/platforms/app-plus/service/api/index.js
+1
-2
src/platforms/mp-weixin/runtime/wrapper/page-base-parser.js
src/platforms/mp-weixin/runtime/wrapper/page-base-parser.js
+5
-0
src/platforms/mp-weixin/runtime/wrapper/util.js
src/platforms/mp-weixin/runtime/wrapper/util.js
+14
-0
未找到文件。
packages/uni-mp-weixin/dist/index.js
浏览文件 @
54686c68
...
...
@@ -328,7 +328,7 @@ const promiseInterceptor = {
};
const
SYNC_API_RE
=
/^
\$
|Window$|WindowStyle$|sendHostEvent|sendNativeEvent|restoreGlobal|requireGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64|getLocale|setLocale|invokePushCallback|getWindowInfo|getDeviceInfo|getAppBaseInfo|getSystemSetting|getAppAuthorizeSetting/
;
/^
\$
|Window$|WindowStyle$|sendHostEvent|sendNativeEvent|restoreGlobal|requireGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64|getLocale|setLocale|invokePushCallback|getWindowInfo|getDeviceInfo|getAppBaseInfo|getSystemSetting|getAppAuthorizeSetting
|initUTS|requireUTS|registerUTS
/
;
const
CONTEXT_API_RE
=
/^create|Manager$/
;
...
...
@@ -923,6 +923,18 @@ var getAppAuthorizeSetting = {
// import navigateTo from 'uni-helpers/navigate-to'
const
compressImage
=
{
args
(
fromArgs
)
{
// https://developers.weixin.qq.com/community/develop/doc/000c08940c865011298e0a43256800?highLine=compressHeight
if
(
fromArgs
.
compressedHeight
&&
!
fromArgs
.
compressHeight
)
{
fromArgs
.
compressHeight
=
fromArgs
.
compressedHeight
;
}
if
(
fromArgs
.
compressedWidth
&&
!
fromArgs
.
compressWidth
)
{
fromArgs
.
compressWidth
=
fromArgs
.
compressedWidth
;
}
}
};
const
protocols
=
{
redirectTo
,
// navigateTo, // 由于在微信开发者工具的页面参数,会显示__id__参数,因此暂时关闭mp-weixin对于navigateTo的AOP
...
...
@@ -933,7 +945,8 @@ const protocols = {
getAppBaseInfo
,
getDeviceInfo
,
getWindowInfo
,
getAppAuthorizeSetting
getAppAuthorizeSetting
,
compressImage
};
const
todos
=
[
'
vibrate
'
,
...
...
@@ -1416,6 +1429,20 @@ function toSkip (obj) {
});
}
return
obj
}
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
];
}
});
}
}
const
MPPage
=
Page
;
...
...
@@ -2423,6 +2450,9 @@ function parseBasePage (vuePageOptions) {
{
initUnknownHooks
(
pageOptions
.
methods
,
vuePageOptions
,
[
'
onReady
'
]);
}
{
initWorkletMethods
(
pageOptions
.
methods
,
vueOptions
.
methods
);
}
return
pageOptions
}
...
...
packages/uni-template-compiler/__tests__/compiler-mp-weixin.spec.js
浏览文件 @
54686c68
...
...
@@ -438,4 +438,11 @@ describe('mp:compiler-mp-weixin', () => {
}
)
})
it
(
'
skyline gesture
'
,
()
=>
{
assertCodegen
(
'
<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"></vertical-drag-gesture-handler>
'
)
})
})
packages/uni-template-compiler/lib/mp.js
浏览文件 @
54686c68
...
...
@@ -83,7 +83,15 @@ const tags = {
'
page-container
'
,
'
page-meta
'
,
'
navigation-bar
'
,
'
match-media
'
'
match-media
'
,
// 手势组件
'
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
'
],
// 支付宝小程序平台独有组件
'
mp-alipay
'
:
[
...
...
@@ -184,4 +192,4 @@ module.exports = function getCompilerOptions (platform) {
baseCompiler
,
require
(
id
+
'
/lib/uni.compiler.js
'
)
)
}
}
packages/webpack-uni-pages-loader/lib/platforms/mp.js
浏览文件 @
54686c68
...
...
@@ -213,6 +213,19 @@ function getCondition (pagesJson) {
return
false
}
function
weixinSkyline
(
config
)
{
return
config
.
renderer
===
'
skyline
'
&&
config
.
lazyCodeLoading
===
'
requiredComponents
'
}
function
openES62ES5
(
config
)
{
if
(
!
config
.
setting
)
{
config
.
setting
=
{}
}
if
(
!
config
.
setting
.
es6
)
{
config
.
setting
.
es6
=
true
}
}
module
.
exports
=
function
(
pagesJson
,
manifestJson
,
project
=
{})
{
const
app
=
{
pages
:
[],
...
...
@@ -291,8 +304,8 @@ module.exports = function (pagesJson, manifestJson, project = {}) {
}
if
(
p
rocess
.
env
.
UNI_PLATFORM
===
'
mp-weixin
'
||
p
rocess
.
env
.
UNI_PLATFORM
===
'
mp-qq
'
p
latform
===
'
mp-weixin
'
||
p
latform
===
'
mp-qq
'
)
{
// 微信不需要生成,其他平台做拷贝
return
{
...
...
@@ -354,6 +367,9 @@ module.exports = function (pagesJson, manifestJson, project = {}) {
}
}
// 使用了微信小程序手势系统,自动开启 ES6=>ES5
platform
===
'
mp-weixin
'
&&
weixinSkyline
(
manifestJson
[
platform
])
&&
openES62ES5
(
project
)
if
(
process
.
env
.
UNI_AUTOMATOR_WS_ENDPOINT
)
{
if
(
!
project
.
setting
)
{
project
.
setting
=
{}
...
...
src/platforms/app-plus/service/api/index.js
浏览文件 @
54686c68
...
...
@@ -71,10 +71,9 @@ export {
initUTSClassName
,
initUTSPackageName
,
requireUTSPlugin
,
registerUTSPlugin
,
registerUTSPlugin
}
from
'
./plugin/uts
'
export
*
from
'
./route/navigate-back
'
export
*
from
'
./route/navigate-to
'
export
*
from
'
./route/re-launch
'
...
...
src/platforms/mp-weixin/runtime/wrapper/page-base-parser.js
浏览文件 @
54686c68
...
...
@@ -10,6 +10,8 @@ import {
import
parseComponent
from
'
uni-platform/runtime/wrapper/component-parser
'
import
{
initWorkletMethods
}
from
'
./util
'
const
hooks
=
[
'
onShow
'
,
'
onHide
'
,
...
...
@@ -38,6 +40,9 @@ export default function parseBasePage (vuePageOptions) {
}
else
{
initUnknownHooks
(
pageOptions
.
methods
,
vuePageOptions
,
[
'
onReady
'
])
}
if
(
__PLATFORM__
===
'
mp-weixin
'
)
{
initWorkletMethods
(
pageOptions
.
methods
,
vueOptions
.
methods
)
}
return
pageOptions
}
src/platforms/mp-weixin/runtime/wrapper/util.js
浏览文件 @
54686c68
...
...
@@ -134,3 +134,17 @@ export function toSkip (obj) {
}
return
obj
}
const
WORKLET_RE
=
/_
(
.*
)
_worklet_factory_/
export
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
]
}
})
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录