Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
良好的行为成为习惯
uni-app
提交
a55bcd5c
U
uni-app
项目概览
良好的行为成为习惯
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a55bcd5c
编写于
10月 19, 2020
作者:
Q
qiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: 解决 Safari 14 输入组件禁用状态文字颜色变浅的问题 question/109013
上级
3e43b17a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
49 addition
and
14 deletion
+49
-14
src/core/view/components/input/index.vue
src/core/view/components/input/index.vue
+26
-8
src/core/view/components/textarea/index.vue
src/core/view/components/textarea/index.vue
+23
-6
未找到文件。
src/core/view/components/input/index.vue
浏览文件 @
a55bcd5c
<
template
>
<uni-input
@
change.stop
v-on=
"$listeners"
<uni-input
@
change.stop
v-on=
"$listeners"
>
<div
ref=
"wrapper"
class=
"uni-input-wrapper"
<div
ref=
"wrapper"
class=
"uni-input-wrapper"
>
<div
v-show=
"!(composing || valueSync.length)"
...
...
@@ -16,6 +16,7 @@
v-text=
"placeholder"
/>
<input
v-if=
"!disabled || !fixColor"
ref=
"input"
v-model=
"valueSync"
v-keyboard
...
...
@@ -33,6 +34,17 @@
@
compositionend=
"_onComposition"
@
keyup.stop=
"_onKeyup"
>
<input
v-if=
"disabled && fixColor"
ref=
"input"
:value=
"valueSync"
tabindex=
"-1"
:readonly=
"disabled"
:type=
"inputType"
:maxlength=
"maxlength"
:step=
"step"
class=
"uni-input-input"
>
</div>
</uni-input>
</
template
>
...
...
@@ -91,7 +103,9 @@ export default {
return
{
composing
:
false
,
wrapperHeight
:
0
,
cachedValue
:
''
cachedValue
:
''
,
// Safari 14 以上修正禁用状态颜色
fixColor
:
String
(
navigator
.
vendor
).
indexOf
(
'
Apple
'
)
===
0
&&
CSS
.
supports
(
'
image-orientation:from-image
'
)
}
},
computed
:
{
...
...
@@ -290,7 +304,6 @@ uni-input[hidden] {
background
:
none
;
color
:
inherit
;
opacity
:
1
;
-webkit-text-fill-color
:
currentcolor
;
font
:
inherit
;
line-height
:
inherit
;
letter-spacing
:
inherit
;
...
...
@@ -313,4 +326,9 @@ uni-input[hidden] {
.uni-input-input
[
type
=
"number"
]
{
-moz-appearance
:
textfield
;
}
.uni-input-input
:disabled
{
/* 用于重置iOS14以下禁用状态文字颜色 */
-webkit-text-fill-color
:
currentcolor
;
}
</
style
>
src/core/view/components/textarea/index.vue
浏览文件 @
a55bcd5c
...
...
@@ -5,7 +5,7 @@
>
<div
class=
"uni-textarea-wrapper"
>
<div
v-show=
"!(composition
||
valueSync.length)"
v-show=
"!(composition
||
valueSync.length)"
ref=
"placeholder"
:style=
"placeholderStyle"
:class=
"placeholderClass"
...
...
@@ -19,7 +19,7 @@
/>
<div
class=
"uni-textarea-compute"
>
<div
v-for=
"(item,index) in valueCompute"
v-for=
"(item,
index) in valueCompute"
:key=
"index"
v-text=
"item.trim() ? item : '.'"
/>
...
...
@@ -29,14 +29,15 @@
/>
</div>
<textarea
v-if=
"!disabled || !fixColor"
ref=
"textarea"
v-model=
"valueSync"
v-keyboard
:disabled=
"disabled"
:maxlength=
"maxlengthNumber"
:autofocus=
"autoFocus || focus"
:class=
"
{
'uni-textarea-textarea-fix-margin': fixMargin
}"
:style="{
'overflow-y': autoHeight? 'hidden':'auto'
}"
:class=
"
{
'uni-textarea-textarea-fix-margin': fixMargin
}"
:style="{
'overflow-y': autoHeight ? 'hidden' : 'auto'
}"
class="uni-textarea-textarea"
@compositionstart="_compositionstart"
@compositionend="_compositionend"
...
...
@@ -45,6 +46,17 @@
@blur="_blur"
@touchstart.passive="_touchstart"
/>
<textarea
v-if=
"disabled && fixColor"
ref=
"textarea"
:value=
"valueSync"
tabindex=
"-1"
:readonly=
"disabled"
:maxlength=
"maxlengthNumber"
:class=
"
{ 'uni-textarea-textarea-fix-margin': fixMargin }"
:style="{ 'overflow-y': autoHeight ? 'hidden' : 'auto' }"
class="uni-textarea-textarea"
/>
</div>
</uni-textarea>
</
template
>
...
...
@@ -114,7 +126,9 @@ export default {
height
:
0
,
focusChangeSource
:
''
,
// iOS 13 以下版本需要修正边距
fixMargin
:
String
(
navigator
.
platform
).
indexOf
(
'
iP
'
)
===
0
&&
String
(
navigator
.
vendor
).
indexOf
(
'
Apple
'
)
===
0
&&
window
.
matchMedia
(
DARK_TEST_STRING
).
media
!==
DARK_TEST_STRING
fixMargin
:
String
(
navigator
.
platform
).
indexOf
(
'
iP
'
)
===
0
&&
String
(
navigator
.
vendor
).
indexOf
(
'
Apple
'
)
===
0
&&
window
.
matchMedia
(
DARK_TEST_STRING
).
media
!==
DARK_TEST_STRING
,
// Safari 14 以上修正禁用状态颜色
fixColor
:
String
(
navigator
.
vendor
).
indexOf
(
'
Apple
'
)
===
0
&&
CSS
.
supports
(
'
image-orientation:from-image
'
)
}
},
computed
:
{
...
...
@@ -340,7 +354,6 @@ uni-textarea[hidden] {
background
:
none
;
color
:
inherit
;
opacity
:
1
;
-webkit-text-fill-color
:
currentcolor
;
font
:
inherit
;
line-height
:
inherit
;
letter-spacing
:
inherit
;
...
...
@@ -355,4 +368,8 @@ uni-textarea[hidden] {
right
:
0
;
margin
:
0
-3px
;
}
.uni-textarea-textarea
:disabled
{
/* 用于重置iOS14以下禁用状态文字颜色 */
-webkit-text-fill-color
:
currentcolor
;
}
</
style
>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录