Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
55c783e7
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,发现更多精彩内容 >>
提交
55c783e7
编写于
11月 23, 2018
作者:
X
xiaoyucoding
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 处理 input number 类型部分输入法可以输入其它字符的情况
上级
52744ab3
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
17 addition
and
21 deletion
+17
-21
src/core/view/components/image/README.md
src/core/view/components/image/README.md
+0
-9
src/core/view/components/input/index.vue
src/core/view/components/input/index.vue
+17
-12
未找到文件。
src/core/view/components/image/README.md
已删除
100644 → 0
浏览文件 @
52744ab3
#### image
|属性名|已完成|
|:-|:-|
|src|Y|
|mode|Y|
|lazy-load||
|@error|Y|
|@load|Y|
\ No newline at end of file
src/core/view/components/input/index.vue
浏览文件 @
55c783e7
...
@@ -15,7 +15,8 @@
...
@@ -15,7 +15,8 @@
@
input.stop=
"_onInput"
@
input.stop=
"_onInput"
@
compositionstart=
"_onComposition"
@
compositionstart=
"_onComposition"
@
compositionend=
"_onComposition"
@
compositionend=
"_onComposition"
@
keyup.stop=
"_onKeyup"
>
@
keyup.stop=
"_onKeyup"
>
<div
<div
v-show=
"!(composing || inputValue.length)"
v-show=
"!(composing || inputValue.length)"
ref=
"placeholder"
ref=
"placeholder"
...
@@ -31,6 +32,7 @@ import {
...
@@ -31,6 +32,7 @@ import {
emitter
emitter
}
from
'
uni-mixins
'
}
from
'
uni-mixins
'
const
TYPES
=
[
'
text
'
,
'
number
'
,
'
idcard
'
,
'
digit
'
,
'
password
'
]
const
TYPES
=
[
'
text
'
,
'
number
'
,
'
idcard
'
,
'
digit
'
,
'
password
'
]
const
NUMBER_TYPES
=
[
'
number
'
,
'
digit
'
]
export
default
{
export
default
{
name
:
'
Input
'
,
name
:
'
Input
'
,
mixins
:
[
emitter
],
mixins
:
[
emitter
],
...
@@ -88,7 +90,8 @@ export default {
...
@@ -88,7 +90,8 @@ export default {
return
{
return
{
inputValue
:
this
.
value
+
''
,
inputValue
:
this
.
value
+
''
,
composing
:
false
,
composing
:
false
,
wrapperHeight
:
0
wrapperHeight
:
0
,
cachedValue
:
''
}
}
},
},
computed
:
{
computed
:
{
...
@@ -124,13 +127,7 @@ export default {
...
@@ -124,13 +127,7 @@ export default {
this
.
inputValue
=
value
+
''
this
.
inputValue
=
value
+
''
},
},
inputValue
(
value
)
{
inputValue
(
value
)
{
// if (value !== this.value) {
// this.$trigger('input', {}, {
// value: value,
// cursor: this.$refs.input.selectionEnd
// })
this
.
$emit
(
'
update:value
'
,
value
)
this
.
$emit
(
'
update:value
'
,
value
)
// }
},
},
maxlength
(
value
)
{
maxlength
(
value
)
{
const
realValue
=
this
.
realValue
.
slice
(
0
,
value
)
const
realValue
=
this
.
realValue
.
slice
(
0
,
value
)
...
@@ -194,11 +191,19 @@ export default {
...
@@ -194,11 +191,19 @@ export default {
if
(
this
.
composing
)
{
if
(
this
.
composing
)
{
return
return
}
}
const
value
=
$event
.
target
.
value
this
.
inputValue
=
value
// 处理部分输入法可以输入其它字符的情况
if
(
~
NUMBER_TYPES
.
indexOf
(
this
.
type
))
{
if
(
this
.
$refs
.
input
.
validity
&&
!
this
.
$refs
.
input
.
validity
.
valid
)
{
this
.
inputValue
=
this
.
cachedValue
$event
.
target
.
value
=
this
.
cachedValue
}
else
{
this
.
cachedValue
=
this
.
inputValue
}
}
this
.
$trigger
(
'
input
'
,
$event
,
{
this
.
$trigger
(
'
input
'
,
$event
,
{
value
:
v
alue
value
:
this
.
inputV
alue
})
})
},
},
_onFocus
(
$event
)
{
_onFocus
(
$event
)
{
...
@@ -226,7 +231,6 @@ export default {
...
@@ -226,7 +231,6 @@ export default {
this
.
composing
=
true
this
.
composing
=
true
}
else
{
}
else
{
this
.
composing
=
false
this
.
composing
=
false
// TODO
}
}
},
},
_resetFormData
()
{
_resetFormData
()
{
...
@@ -274,6 +278,7 @@ export default {
...
@@ -274,6 +278,7 @@ export default {
text-overflow
:
inherit
;
text-overflow
:
inherit
;
-webkit-tap-highlight-color
:
transparent
;
-webkit-tap-highlight-color
:
transparent
;
z-index
:
2
;
z-index
:
2
;
opacity
:
inherit
;
}
}
uni-input
[
hidden
]
{
uni-input
[
hidden
]
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录