Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qianlong66
uni-app
提交
5d56184c
U
uni-app
项目概览
qianlong66
/
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,发现更多精彩内容 >>
提交
5d56184c
编写于
9月 02, 2022
作者:
Q
qiang
浏览文件
操作
浏览文件
下载
差异文件
chore: Merge branch 'next' of github.com:dcloudio/uni-app into next
上级
7e0de812
431d48c7
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
61 addition
and
21 deletion
+61
-21
packages/uni-app-plus/src/service/api/context/operateMap.ts
packages/uni-app-plus/src/service/api/context/operateMap.ts
+2
-1
packages/uni-app-plus/src/service/api/context/operateVideoPlayer.ts
...ni-app-plus/src/service/api/context/operateVideoPlayer.ts
+2
-1
packages/uni-h5/src/service/api/device/clipboard.ts
packages/uni-h5/src/service/api/device/clipboard.ts
+37
-11
packages/uni-mp-kuaishou/__tests__/vOn.spec.ts
packages/uni-mp-kuaishou/__tests__/vOn.spec.ts
+19
-8
packages/uni-mp-kuaishou/src/compiler/transforms/vOn.ts
packages/uni-mp-kuaishou/src/compiler/transforms/vOn.ts
+1
-0
未找到文件。
packages/uni-app-plus/src/service/api/context/operateMap.ts
浏览文件 @
5d56184c
import
{
ComponentPublicInstance
}
from
'
vue
'
import
{
findElmById
,
invokeVmMethod
,
invokeVmMethodWithoutArgs
}
from
'
../util
'
import
{
getPageById
}
from
'
../../framework/page/getCurrentPages
'
type
Methords
=
Record
<
string
,
(
ctx
:
any
,
args
:
any
)
=>
void
>
...
...
@@ -64,7 +65,7 @@ export function operateMap(
data
?:
unknown
,
operateMapCallback
?:
(
res
:
any
)
=>
void
)
{
const
page
=
get
CurrentPages
().
find
((
page
)
=>
page
.
$page
.
id
===
pageId
)
const
page
=
get
PageById
(
pageId
)
if
(
page
?.
$page
.
meta
.
isNVue
)
{
const
pageVm
=
(
page
as
any
).
$vm
as
ComponentPublicInstance
return
METHODS
[
type
as
keyof
typeof
METHODS
](
...
...
packages/uni-app-plus/src/service/api/context/operateVideoPlayer.ts
浏览文件 @
5d56184c
import
{
ComponentPublicInstance
}
from
'
vue
'
import
{
findElmById
,
invokeVmMethod
,
invokeVmMethodWithoutArgs
}
from
'
../util
'
import
{
getPageById
}
from
'
../../framework/page/getCurrentPages
'
const
METHODS
=
{
play
(
ctx
:
any
)
{
...
...
@@ -43,7 +44,7 @@ export function operateVideoPlayer(
type
:
string
,
data
?:
unknown
)
{
const
page
=
get
CurrentPages
().
find
((
page
)
=>
page
.
$page
.
id
===
pageId
)
const
page
=
get
PageById
(
pageId
)
if
(
page
?.
$page
.
meta
.
isNVue
)
{
const
pageVm
=
(
page
as
any
).
$vm
as
ComponentPublicInstance
return
METHODS
[
type
as
keyof
typeof
METHODS
](
...
...
packages/uni-h5/src/service/api/device/clipboard.ts
浏览文件 @
5d56184c
...
...
@@ -7,10 +7,10 @@ import {
SetClipboardDataProtocol
,
defineAsyncApi
,
}
from
'
@dcloudio/uni-api
'
import
{
showModal
}
from
'
../../api/ui/popup/showModal
'
//
import { showModal } from '../../api/ui/popup/showModal'
import
{
useI18n
,
initI18nSetClipboardDataMsgsOnce
,
//
initI18nSetClipboardDataMsgsOnce,
initI18nGetClipboardDataMsgsOnce
,
}
from
'
@dcloudio/uni-core
'
...
...
@@ -23,7 +23,9 @@ export const getClipboardData = defineAsyncApi<API_TYPE_GET_CLIPBOARD_DATA>(
const
data
=
await
navigator
.
clipboard
.
readText
()
resolve
({
data
})
}
catch
(
error
:
any
)
{
_getClipboardData
(
resolve
,
()
=>
{
reject
(
`
${
error
}
${
t
(
'
uni.getClipboardData.fail
'
)}
`
)
})
}
}
)
...
...
@@ -31,20 +33,44 @@ export const getClipboardData = defineAsyncApi<API_TYPE_GET_CLIPBOARD_DATA>(
export
const
setClipboardData
=
defineAsyncApi
<
API_TYPE_SET_CLIPBOARD_DATA
>
(
API_SET_CLIPBOARD_DATA
,
async
({
data
},
{
resolve
,
reject
})
=>
{
initI18nSetClipboardDataMsgsOnce
()
const
{
t
}
=
useI18n
()
try
{
await
navigator
.
clipboard
.
writeText
(
data
)
resolve
()
}
catch
(
error
)
{
reject
()
showModal
({
title
:
t
(
'
uni.setClipboardData.fail
'
),
content
:
data
,
editable
:
true
,
})
_setClipboardData
(
data
,
resolve
,
reject
)
}
},
SetClipboardDataProtocol
,
SetClipboardDataOptions
)
function
_getClipboardData
(
resolve
:
Function
,
reject
:
Function
)
{
const
pasteText
=
document
.
getElementById
(
'
#clipboard
'
)
as
HTMLInputElement
const
data
=
pasteText
?
pasteText
.
value
:
undefined
if
(
data
)
{
resolve
({
data
})
}
else
{
reject
()
}
}
function
_setClipboardData
(
data
:
string
,
resolve
:
Function
,
reject
:
Function
)
{
const
pasteText
=
document
.
getElementById
(
'
#clipboard
'
)
pasteText
&&
pasteText
.
remove
()
const
textarea
=
document
.
createElement
(
'
textarea
'
)
textarea
.
id
=
'
#clipboard
'
textarea
.
style
.
position
=
'
fixed
'
textarea
.
style
.
top
=
'
-9999px
'
textarea
.
style
.
zIndex
=
'
-9999
'
document
.
body
.
appendChild
(
textarea
)
textarea
.
value
=
data
textarea
.
select
()
textarea
.
setSelectionRange
(
0
,
textarea
.
value
.
length
)
const
result
=
document
.
execCommand
(
'
Copy
'
,
false
)
textarea
.
blur
()
if
(
result
)
{
resolve
()
}
else
{
reject
()
}
}
packages/uni-mp-kuaishou/__tests__/vOn.spec.ts
浏览文件 @
5d56184c
...
...
@@ -39,13 +39,24 @@ describe('mp-kuaishou: transform v-on', () => {
return { a: _j({ 'click': _o(_ctx.click) }) }
}`
)
})
,
})
test
(
`multi custom event`
,
()
=>
{
assert
(
`<custom @unmount="unmount" @custom-mount="mount();created();"/>`
,
`<custom bindunmount="__e" bindcustomMount="__e" u-i="2a9ec0b0-0" bind:__l="__l" eO="{{a}}"/>`
,
`(_ctx, _cache) => {
return { a: _j({ 'unmount': _o(_ctx.unmount), 'customMount': _o($event => { _ctx.mount(); _ctx.created(); }) }) }
}`
)
})
})
describe
(
'
event
'
,
()
=>
{
test
(
`getphonenumber`
,
()
=>
{
assert
(
`<button open-type="getPhoneNumber" @getphonenumber="getInfo"></button>`
,
`<button open-type="getPhoneNumber" bindgetphonenumber="__e" data-e-o="{{a}}"></button>`
,
`(_ctx, _cache) => {
return { a: { 'getphonenumber': _o(_ctx.getInfo) } }
}`
)
})
...
...
packages/uni-mp-kuaishou/src/compiler/transforms/vOn.ts
浏览文件 @
5d56184c
...
...
@@ -5,6 +5,7 @@ import { transformOn as baseTransformOn } from '@dcloudio/uni-mp-compiler'
*/
export
const
transformOn
=
createTransformOn
(
baseTransformOn
,
{
match
:
(
name
,
node
,
context
)
=>
{
if
(
name
===
'
getphonenumber
'
)
return
true
if
(
name
===
'
input
'
&&
(
node
.
tag
===
'
input
'
||
node
.
tag
===
'
textarea
'
))
{
return
true
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录