Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
r15132706585
uni-app
提交
c9500005
U
uni-app
项目概览
r15132706585
/
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,发现更多精彩内容 >>
提交
c9500005
编写于
10月 11, 2021
作者:
D
DCloud_LXH
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: showModal 支持 editable 配置输入框
上级
5ba40e9e
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
63 addition
and
18 deletion
+63
-18
src/platforms/app-plus/service/api/ui/popup.js
src/platforms/app-plus/service/api/ui/popup.js
+19
-8
src/platforms/h5/components/app/popup/mixins/modal.js
src/platforms/h5/components/app/popup/mixins/modal.js
+3
-3
src/platforms/h5/components/app/popup/modal.vue
src/platforms/h5/components/app/popup/modal.vue
+38
-2
src/platforms/h5/service/api/ui/popup.js
src/platforms/h5/service/api/ui/popup.js
+3
-5
未找到文件。
src/platforms/app-plus/service/api/ui/popup.js
浏览文件 @
c9500005
...
...
@@ -121,24 +121,35 @@ export function showModal ({
cancelText
,
cancelColor
,
confirmText
,
confirmColor
confirmColor
,
editable
=
false
,
placeholderText
=
''
}
=
{},
callbackId
)
{
// TODO 在 editable 为 true 时,content 应该是输入框中可修改内容。后续找客户端商量。
const
buttons
=
showCancel
?
[
cancelText
,
confirmText
]
:
[
confirmText
]
const
tip
=
editable
?
placeholderText
:
buttons
content
=
content
||
'
'
plus
.
nativeUI
.
confirm
(
content
,
(
e
)
=>
{
plus
.
nativeUI
[
editable
?
'
prompt
'
:
'
confirm
'
]
(
content
,
(
e
)
=>
{
if
(
showCancel
)
{
invoke
(
callbackId
,
{
const
isConfirm
=
e
.
index
===
1
const
res
=
{
errMsg
:
'
showModal:ok
'
,
confirm
:
e
.
index
===
1
,
confirm
:
isConfirm
,
cancel
:
e
.
index
===
0
||
e
.
index
===
-
1
})
}
isConfirm
&&
editable
&&
(
res
.
content
=
e
.
value
)
invoke
(
callbackId
,
res
)
}
else
{
invoke
(
callbackId
,
{
const
res
=
{
errMsg
:
'
showModal:ok
'
,
confirm
:
e
.
index
===
0
,
cancel
:
false
})
}
editable
&&
(
res
.
content
=
e
.
value
)
invoke
(
callbackId
,
res
)
}
},
title
,
showCancel
?
[
cancelText
,
confirmText
]
:
[
confirmText
]
)
},
title
,
tip
,
buttons
)
}
export
function
showActionSheet
({
itemList
=
[],
...
...
src/platforms/h5/components/app/popup/mixins/modal.js
浏览文件 @
c9500005
...
...
@@ -21,9 +21,9 @@ export default {
},
methods
:
{
// 处理 modal close 回调
_onModalClose
(
type
)
{
_onModalClose
(
res
)
{
this
.
showModal
.
visible
=
false
isFn
(
this
.
onModalCloseCallback
)
&&
this
.
onModalCloseCallback
(
type
)
isFn
(
this
.
onModalCloseCallback
)
&&
this
.
onModalCloseCallback
(
res
)
}
}
}
}
src/platforms/h5/components/app/popup/modal.vue
浏览文件 @
c9500005
...
...
@@ -15,7 +15,16 @@
v-text=
"title"
/>
</div>
<textarea
v-if=
"editable"
ref=
"editContent"
class=
"uni-modal__textarea"
rows=
"1"
:placeholder=
"placeholderText"
:value=
"content"
/>
<div
v-else
class=
"uni-modal__bd"
@
touchmove.stop
v-text=
"content"
...
...
@@ -41,7 +50,7 @@
<keypress
:disable=
"!visible"
@
esc=
"_close('cancel')"
@
enter=
"_close('confirm')"
@
enter=
"
!editable &&
_close('confirm')"
/>
</uni-modal>
</transition>
...
...
@@ -86,11 +95,25 @@ export default {
visible
:
{
type
:
Boolean
,
default
:
false
},
editable
:
{
type
:
Boolean
,
default
:
false
},
placeholderText
:
{
type
:
String
,
default
:
''
}
},
methods
:
{
_close
(
type
)
{
this
.
$emit
(
'
close
'
,
type
)
const
res
=
{
[
type
]:
true
}
if
(
this
.
editable
&&
type
===
'
confirm
'
)
{
res
.
content
=
this
.
$refs
.
editContent
.
value
}
this
.
$emit
(
'
close
'
,
res
)
}
}
}
...
...
@@ -156,6 +179,19 @@ export default {
overflow-y
:
auto
;
}
uni-modal
.uni-modal__textarea
{
resize
:
none
;
border
:
0
;
margin
:
0
;
width
:
90%
;
padding
:
10px
;
font-size
:
20px
;
outline
:
none
;
border
:
none
;
background-color
:
#eee
;
text-decoration
:
inherit
;
}
uni-modal
.uni-modal__ft
{
position
:
relative
;
line-height
:
48px
;
...
...
src/platforms/h5/service/api/ui/popup.js
浏览文件 @
c9500005
...
...
@@ -4,10 +4,8 @@ const {
}
=
UniServiceJSBridge
export
function
showModal
(
args
,
callbackId
)
{
emit
(
'
onShowModal
'
,
args
,
function
(
type
)
{
invoke
(
callbackId
,
{
[
type
]:
true
})
emit
(
'
onShowModal
'
,
args
,
function
(
res
)
{
invoke
(
callbackId
,
res
)
})
}
...
...
@@ -43,4 +41,4 @@ export function showActionSheet (args, callbackId) {
})
}
})
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录