Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
f93866ba
U
uni-app
项目概览
DCloud
/
uni-app
2 个月 前同步成功
通知
717
Star
38705
Fork
3642
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
7
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
7
Issue
7
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f93866ba
编写于
4月 13, 2020
作者:
雪洛
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: button组件openType失效的Bug
上级
4a15e384
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
354 addition
and
296 deletion
+354
-296
src/core/view/components/button/index.vue
src/core/view/components/button/index.vue
+354
-296
未找到文件。
src/core/view/components/button/index.vue
浏览文件 @
f93866ba
<
script
>
<
script
>
import
{
import
{
hover
,
emitter
,
listeners
}
from
'
uni-mixins
'
hover
,
emitter
,
listeners
}
from
'
uni-mixins
'
export
default
{
export
default
{
name
:
'
Button
'
,
name
:
'
Button
'
,
mixins
:
[
hover
,
emitter
,
listeners
],
mixins
:
[
hover
,
emitter
,
listeners
],
...
@@ -39,6 +35,10 @@ export default {
...
@@ -39,6 +35,10 @@ export default {
// 只有这几个可取值,其它都是非法的。
// 只有这几个可取值,其它都是非法的。
return
~
[
''
,
'
submit
'
,
'
reset
'
].
indexOf
(
value
)
return
~
[
''
,
'
submit
'
,
'
reset
'
].
indexOf
(
value
)
}
}
},
openType
:
{
type
:
String
,
default
:
''
}
}
},
},
data
()
{
data
()
{
...
@@ -56,10 +56,54 @@ export default {
...
@@ -56,10 +56,54 @@ export default {
}
}
// TODO 通知父表单执行相应的行为
// TODO 通知父表单执行相应的行为
if
(
this
.
formType
)
{
if
(
this
.
formType
)
{
this
.
$dispatch
(
'
Form
'
,
this
.
formType
===
'
submit
'
?
'
uni-form-submit
'
:
'
uni-form-reset
'
,
{
this
.
$dispatch
(
'
Form
'
,
this
.
formType
===
'
submit
'
?
'
uni-form-submit
'
:
'
uni-form-reset
'
,
{
type
:
this
.
formType
type
:
this
.
formType
}
)
return
}
if
(
this
.
openType
===
'
feedback
'
)
{
const
feedback
=
plus
.
webview
.
create
(
'
https://service.dcloud.net.cn/uniapp/feedback.html
'
,
'
feedback
'
,
{
titleNView
:
{
titleText
:
'
问题反馈
'
,
autoBackButton
:
true
,
backgroundColor
:
'
#F7F7F7
'
,
titleColor
:
'
#007aff
'
}
}
)
feedback
.
show
(
'
slide-in-right
'
)
feedback
.
getTitleNView
&&
setTimeout
(
function
()
{
let
title
=
feedback
.
getTitleNView
()
if
(
title
)
{
title
.
drawText
(
'
发送
'
,
{
top
:
0
,
left
:
window
.
innerWidth
-
60
,
width
:
60
,
height
:
44
},
{
color
:
'
#007aff
'
,
weight
:
'
bold
'
}
)
title
.
addEventListener
(
'
click
'
,
function
(
e
)
{
feedback
.
evalJS
(
'
mui&&mui.trigger(document.getElementById("submit"),"tap")
'
)
})
})
}
}
},
100
)
}
},
},
_bindObjectListeners
(
data
,
value
)
{
_bindObjectListeners
(
data
,
value
)
{
if
(
value
)
{
if
(
value
)
{
...
@@ -83,10 +127,13 @@ export default {
...
@@ -83,10 +127,13 @@ export default {
})
})
}
}
if
(
this
.
hoverClass
&&
this
.
hoverClass
!==
'
none
'
)
{
if
(
this
.
hoverClass
&&
this
.
hoverClass
!==
'
none
'
)
{
return
createElement
(
'
uni-button
'
,
this
.
_bindObjectListeners
({
return
createElement
(
'
uni-button
'
,
this
.
_bindObjectListeners
(
{
class
:
[
this
.
hovering
?
this
.
hoverClass
:
''
],
class
:
[
this
.
hovering
?
this
.
hoverClass
:
''
],
attrs
:
{
attrs
:
{
'
disabled
'
:
this
.
disabled
disabled
:
this
.
disabled
},
},
on
:
{
on
:
{
touchstart
:
this
.
_hoverTouchStart
,
touchstart
:
this
.
_hoverTouchStart
,
...
@@ -94,17 +141,28 @@ export default {
...
@@ -94,17 +141,28 @@ export default {
touchcancel
:
this
.
_hoverTouchCancel
,
touchcancel
:
this
.
_hoverTouchCancel
,
click
:
this
.
_onClick
click
:
this
.
_onClick
}
}
},
$listeners
),
this
.
$slots
.
default
)
},
$listeners
),
this
.
$slots
.
default
)
}
else
{
}
else
{
return
createElement
(
'
uni-button
'
,
this
.
_bindObjectListeners
({
return
createElement
(
'
uni-button
'
,
this
.
_bindObjectListeners
(
{
class
:
[
this
.
hovering
?
this
.
hoverClass
:
''
],
class
:
[
this
.
hovering
?
this
.
hoverClass
:
''
],
attrs
:
{
attrs
:
{
'
disabled
'
:
this
.
disabled
disabled
:
this
.
disabled
},
},
on
:
{
on
:
{
click
:
this
.
_onClick
click
:
this
.
_onClick
}
}
},
$listeners
),
this
.
$slots
.
default
)
},
$listeners
),
this
.
$slots
.
default
)
}
}
},
},
listeners
:
{
listeners
:
{
...
@@ -114,7 +172,7 @@ export default {
...
@@ -114,7 +172,7 @@ export default {
}
}
</
script
>
</
script
>
<
style
>
<
style
>
uni-button
{
uni-button
{
position
:
relative
;
position
:
relative
;
display
:
block
;
display
:
block
;
margin-left
:
auto
;
margin-left
:
auto
;
...
@@ -130,15 +188,15 @@ export default {
...
@@ -130,15 +188,15 @@ export default {
-webkit-tap-highlight-color
:
transparent
;
-webkit-tap-highlight-color
:
transparent
;
overflow
:
hidden
;
overflow
:
hidden
;
color
:
#000000
;
color
:
#000000
;
background-color
:
#F8F8F
8
;
background-color
:
#f8f8f
8
;
cursor
:
pointer
;
cursor
:
pointer
;
}
}
uni-button
[
hidden
]
{
uni-button
[
hidden
]
{
display
:
none
!important
;
display
:
none
!important
;
}
}
uni-button
:after
{
uni-button
:after
{
content
:
" "
;
content
:
" "
;
width
:
200%
;
width
:
200%
;
height
:
200%
;
height
:
200%
;
...
@@ -152,148 +210,148 @@ export default {
...
@@ -152,148 +210,148 @@ export default {
transform-origin
:
0
0
;
transform-origin
:
0
0
;
box-sizing
:
border-box
;
box-sizing
:
border-box
;
border-radius
:
10px
;
border-radius
:
10px
;
}
}
uni-button
[
native
]
{
uni-button
[
native
]
{
padding-left
:
0
;
padding-left
:
0
;
padding-right
:
0
;
padding-right
:
0
;
}
}
uni-button
[
native
]
.uni-button-cover-view-wrapper
{
uni-button
[
native
]
.uni-button-cover-view-wrapper
{
border
:
inherit
;
border
:
inherit
;
border-color
:
inherit
;
border-color
:
inherit
;
border-radius
:
inherit
;
border-radius
:
inherit
;
background-color
:
inherit
;
background-color
:
inherit
;
}
}
uni-button
[
native
]
.uni-button-cover-view-inner
{
uni-button
[
native
]
.uni-button-cover-view-inner
{
padding-left
:
14px
;
padding-left
:
14px
;
padding-right
:
14px
;
padding-right
:
14px
;
}
}
uni-button
uni-cover-view
{
uni-button
uni-cover-view
{
line-height
:
inherit
;
line-height
:
inherit
;
white-space
:
inherit
;
white-space
:
inherit
;
}
}
uni-button
[
type
=
default
]
{
uni-button
[
type
=
"default"
]
{
color
:
#000000
;
color
:
#000000
;
background-color
:
#F8F8F
8
;
background-color
:
#f8f8f
8
;
}
}
uni-button
[
type
=
primary
]
{
uni-button
[
type
=
"primary"
]
{
color
:
#FFFFFF
;
color
:
#ffffff
;
background-color
:
#007aff
;
background-color
:
#007aff
;
}
}
uni-button
[
type
=
warn
]
{
uni-button
[
type
=
"warn"
]
{
color
:
#FFFFFF
;
color
:
#ffffff
;
background-color
:
#E
64340
;
background-color
:
#e
64340
;
}
}
uni-button
[
disabled
]
{
uni-button
[
disabled
]
{
color
:
rgba
(
255
,
255
,
255
,
0.6
);
color
:
rgba
(
255
,
255
,
255
,
0.6
);
cursor
:
not-allowed
;
cursor
:
not-allowed
;
}
}
uni-button
[
disabled
][
type
=
default
],
uni-button
[
disabled
][
type
=
"default"
],
uni-button
[
disabled
]
:not
([
type
])
{
uni-button
[
disabled
]
:not
([
type
])
{
color
:
rgba
(
0
,
0
,
0
,
0.3
);
color
:
rgba
(
0
,
0
,
0
,
0.3
);
background-color
:
#F7F7F
7
;
background-color
:
#f7f7f
7
;
}
}
uni-button
[
disabled
][
type
=
primary
]
{
uni-button
[
disabled
][
type
=
"primary"
]
{
background-color
:
rgba
(
0
,
122
,
255
,
0.6
);
background-color
:
rgba
(
0
,
122
,
255
,
0.6
);
}
}
uni-button
[
disabled
][
type
=
warn
]
{
uni-button
[
disabled
][
type
=
"warn"
]
{
background-color
:
#EC8B
89
;
background-color
:
#ec8b
89
;
}
}
uni-button
[
type
=
primary
][
plain
]
{
uni-button
[
type
=
"primary"
][
plain
]
{
color
:
#007aff
;
color
:
#007aff
;
border
:
1px
solid
#007aff
;
border
:
1px
solid
#007aff
;
background-color
:
transparent
;
background-color
:
transparent
;
}
}
uni-button
[
type
=
primary
][
plain
][
disabled
]
{
uni-button
[
type
=
"primary"
][
plain
][
disabled
]
{
color
:
rgba
(
0
,
0
,
0
,
0.2
);
color
:
rgba
(
0
,
0
,
0
,
0.2
);
border-color
:
rgba
(
0
,
0
,
0
,
0.2
);
border-color
:
rgba
(
0
,
0
,
0
,
0.2
);
}
}
uni-button
[
type
=
primary
][
plain
]
:after
{
uni-button
[
type
=
"primary"
][
plain
]
:after
{
border-width
:
0
;
border-width
:
0
;
}
}
uni-button
[
type
=
default
][
plain
]
{
uni-button
[
type
=
"default"
][
plain
]
{
color
:
#353535
;
color
:
#353535
;
border
:
1px
solid
#353535
;
border
:
1px
solid
#353535
;
background-color
:
transparent
;
background-color
:
transparent
;
}
}
uni-button
[
type
=
default
][
plain
][
disabled
]
{
uni-button
[
type
=
"default"
][
plain
][
disabled
]
{
color
:
rgba
(
0
,
0
,
0
,
0.2
);
color
:
rgba
(
0
,
0
,
0
,
0.2
);
border-color
:
rgba
(
0
,
0
,
0
,
0.2
);
border-color
:
rgba
(
0
,
0
,
0
,
0.2
);
}
}
uni-button
[
type
=
default
][
plain
]
:after
{
uni-button
[
type
=
"default"
][
plain
]
:after
{
border-width
:
0
;
border-width
:
0
;
}
}
uni-button
[
plain
]
{
uni-button
[
plain
]
{
color
:
#353535
;
color
:
#353535
;
border
:
1px
solid
#353535
;
border
:
1px
solid
#353535
;
background-color
:
transparent
;
background-color
:
transparent
;
}
}
uni-button
[
plain
][
disabled
]
{
uni-button
[
plain
][
disabled
]
{
color
:
rgba
(
0
,
0
,
0
,
0.2
);
color
:
rgba
(
0
,
0
,
0
,
0.2
);
border-color
:
rgba
(
0
,
0
,
0
,
0.2
);
border-color
:
rgba
(
0
,
0
,
0
,
0.2
);
}
}
uni-button
[
plain
]
:after
{
uni-button
[
plain
]
:after
{
border-width
:
0
;
border-width
:
0
;
}
}
uni-button
[
plain
][
native
]
.uni-button-cover-view-inner
{
uni-button
[
plain
][
native
]
.uni-button-cover-view-inner
{
padding
:
0
;
padding
:
0
;
}
}
uni-button
[
type
=
warn
][
plain
]
{
uni-button
[
type
=
"warn"
][
plain
]
{
color
:
#e64340
;
color
:
#e64340
;
border
:
1px
solid
#e64340
;
border
:
1px
solid
#e64340
;
background-color
:
transparent
;
background-color
:
transparent
;
}
}
uni-button
[
type
=
warn
][
plain
][
disabled
]
{
uni-button
[
type
=
"warn"
][
plain
][
disabled
]
{
color
:
rgba
(
0
,
0
,
0
,
0.2
);
color
:
rgba
(
0
,
0
,
0
,
0.2
);
border-color
:
rgba
(
0
,
0
,
0
,
0.2
);
border-color
:
rgba
(
0
,
0
,
0
,
0.2
);
}
}
uni-button
[
type
=
warn
][
plain
]
:after
{
uni-button
[
type
=
"warn"
][
plain
]
:after
{
border-width
:
0
;
border-width
:
0
;
}
}
uni-button
[
size
=
mini
]
{
uni-button
[
size
=
"mini"
]
{
display
:
inline-block
;
display
:
inline-block
;
line-height
:
2.3
;
line-height
:
2.3
;
font-size
:
13px
;
font-size
:
13px
;
padding
:
0
1.34em
;
padding
:
0
1.34em
;
}
}
uni-button
[
size
=
mini
][
native
]
{
uni-button
[
size
=
"mini"
][
native
]
{
padding
:
0
;
padding
:
0
;
}
}
uni-button
[
size
=
mini
][
native
]
.uni-button-cover-view-inner
{
uni-button
[
size
=
"mini"
][
native
]
.uni-button-cover-view-inner
{
padding
:
0
1.34em
;
padding
:
0
1.34em
;
}
}
uni-button
[
loading
]
:not
([
disabled
])
{
uni-button
[
loading
]
:not
([
disabled
])
{
cursor
:
progress
;
cursor
:
progress
;
}
}
uni-button
[
loading
]
:before
{
uni-button
[
loading
]
:before
{
content
:
" "
;
content
:
" "
;
display
:
inline-block
;
display
:
inline-block
;
width
:
18px
;
width
:
18px
;
...
@@ -302,83 +360,83 @@ export default {
...
@@ -302,83 +360,83 @@ export default {
-webkit-animation
:
uni-loading
1s
steps
(
12
,
end
)
infinite
;
-webkit-animation
:
uni-loading
1s
steps
(
12
,
end
)
infinite
;
animation
:
uni-loading
1s
steps
(
12
,
end
)
infinite
;
animation
:
uni-loading
1s
steps
(
12
,
end
)
infinite
;
background-size
:
100%
;
background-size
:
100%
;
}
}
uni-button
[
loading
][
type
=
primary
]
{
uni-button
[
loading
][
type
=
"primary"
]
{
color
:
rgba
(
255
,
255
,
255
,
0.6
);
color
:
rgba
(
255
,
255
,
255
,
0.6
);
background-color
:
#0062cc
;
background-color
:
#0062cc
;
}
}
uni-button
[
loading
][
type
=
primary
][
plain
]
{
uni-button
[
loading
][
type
=
"primary"
][
plain
]
{
color
:
#007aff
;
color
:
#007aff
;
background-color
:
transparent
;
background-color
:
transparent
;
}
}
uni-button
[
loading
][
type
=
default
]
{
uni-button
[
loading
][
type
=
"default"
]
{
color
:
rgba
(
0
,
0
,
0
,
0.6
);
color
:
rgba
(
0
,
0
,
0
,
0.6
);
background-color
:
#DEDEDE
;
background-color
:
#dedede
;
}
}
uni-button
[
loading
][
type
=
default
][
plain
]
{
uni-button
[
loading
][
type
=
"default"
][
plain
]
{
color
:
#353535
;
color
:
#353535
;
background-color
:
transparent
;
background-color
:
transparent
;
}
}
uni-button
[
loading
][
type
=
warn
]
{
uni-button
[
loading
][
type
=
"warn"
]
{
color
:
rgba
(
255
,
255
,
255
,
0.6
);
color
:
rgba
(
255
,
255
,
255
,
0.6
);
background-color
:
#CE3C
39
;
background-color
:
#ce3c
39
;
}
}
uni-button
[
loading
][
type
=
warn
][
plain
]
{
uni-button
[
loading
][
type
=
"warn"
][
plain
]
{
color
:
#e64340
;
color
:
#e64340
;
background-color
:
transparent
;
background-color
:
transparent
;
}
}
uni-button
[
loading
][
native
]
:before
{
uni-button
[
loading
][
native
]
:before
{
content
:
none
;
content
:
none
;
}
}
.button-hover
{
.button-hover
{
color
:
rgba
(
0
,
0
,
0
,
0.6
);
color
:
rgba
(
0
,
0
,
0
,
0.6
);
background-color
:
#DEDEDE
;
background-color
:
#dedede
;
}
}
.button-hover
[
plain
]
{
.button-hover
[
plain
]
{
color
:
rgba
(
53
,
53
,
53
,
0.6
);
color
:
rgba
(
53
,
53
,
53
,
0.6
);
border-color
:
rgba
(
53
,
53
,
53
,
0.6
);
border-color
:
rgba
(
53
,
53
,
53
,
0.6
);
background-color
:
transparent
;
background-color
:
transparent
;
}
}
.button-hover
[
type
=
primary
]
{
.button-hover
[
type
=
"primary"
]
{
color
:
rgba
(
255
,
255
,
255
,
0.6
);
color
:
rgba
(
255
,
255
,
255
,
0.6
);
background-color
:
#0062cc
;
background-color
:
#0062cc
;
}
}
.button-hover
[
type
=
primary
][
plain
]
{
.button-hover
[
type
=
"primary"
][
plain
]
{
color
:
rgba
(
26
,
173
,
25
,
0.6
);
color
:
rgba
(
26
,
173
,
25
,
0.6
);
border-color
:
rgba
(
26
,
173
,
25
,
0.6
);
border-color
:
rgba
(
26
,
173
,
25
,
0.6
);
background-color
:
transparent
;
background-color
:
transparent
;
}
}
.button-hover
[
type
=
default
]
{
.button-hover
[
type
=
"default"
]
{
color
:
rgba
(
0
,
0
,
0
,
0.6
);
color
:
rgba
(
0
,
0
,
0
,
0.6
);
background-color
:
#DEDEDE
;
background-color
:
#dedede
;
}
}
.button-hover
[
type
=
default
][
plain
]
{
.button-hover
[
type
=
"default"
][
plain
]
{
color
:
rgba
(
53
,
53
,
53
,
0.6
);
color
:
rgba
(
53
,
53
,
53
,
0.6
);
border-color
:
rgba
(
53
,
53
,
53
,
0.6
);
border-color
:
rgba
(
53
,
53
,
53
,
0.6
);
background-color
:
transparent
;
background-color
:
transparent
;
}
}
.button-hover
[
type
=
warn
]
{
.button-hover
[
type
=
"warn"
]
{
color
:
rgba
(
255
,
255
,
255
,
0.6
);
color
:
rgba
(
255
,
255
,
255
,
0.6
);
background-color
:
#CE3C
39
;
background-color
:
#ce3c
39
;
}
}
.button-hover
[
type
=
warn
][
plain
]
{
.button-hover
[
type
=
"warn"
][
plain
]
{
color
:
rgba
(
230
,
67
,
64
,
0.6
);
color
:
rgba
(
230
,
67
,
64
,
0.6
);
border-color
:
rgba
(
230
,
67
,
64
,
0.6
);
border-color
:
rgba
(
230
,
67
,
64
,
0.6
);
background-color
:
transparent
;
background-color
:
transparent
;
}
}
</
style
>
</
style
>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录