Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
3736f6aa
U
uni-app
项目概览
DCloud
/
uni-app
4 个月 前同步成功
通知
730
Star
38706
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,发现更多精彩内容 >>
提交
3736f6aa
编写于
3月 28, 2019
作者:
fxy060608
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dev' of
https://github.com/dcloudio/uni-app
into dev
上级
69f43048
7028ffe1
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
33 addition
and
15 deletion
+33
-15
src/core/view/components/textarea/index.vue
src/core/view/components/textarea/index.vue
+33
-15
未找到文件。
src/core/view/components/textarea/index.vue
浏览文件 @
3736f6aa
<
template
>
<
template
>
<uni-textarea
<uni-textarea
v-on=
"$listeners"
>
style=
"height:height+'px'"
v-on=
"$listeners"
>
<div
<div
ref=
"wrapped"
ref=
"wrapped"
class=
"uni-textarea-wrapped"
>
class=
"uni-textarea-wrapped"
>
...
@@ -10,7 +8,16 @@
...
@@ -10,7 +8,16 @@
ref=
"placeholder"
ref=
"placeholder"
:style=
"placeholderStyle"
:style=
"placeholderStyle"
:class=
"placeholderClass"
:class=
"placeholderClass"
class=
"uni-textarea-placeholder"
>
{{
placeholder
}}
</div>
class=
"uni-textarea-placeholder"
>
{{
placeholder
}}
</div>
<div
class=
"uni-textarea-compute"
>
<div
v-for=
"(item,index) in valueCompute"
:key=
"index"
>
{{
item
||
'
.
'
}}
</div>
<v-uni-resize-sensor
ref=
"sensor"
@
resize=
"_resize"
/>
</div>
<textarea
<textarea
ref=
"textarea"
ref=
"textarea"
v-model=
"valueSync"
v-model=
"valueSync"
...
@@ -21,11 +28,11 @@
...
@@ -21,11 +28,11 @@
class=
"uni-textarea-textarea"
class=
"uni-textarea-textarea"
@
compositionstart=
"_compositionstart"
@
compositionstart=
"_compositionstart"
@
compositionend=
"_compositionend"
@
compositionend=
"_compositionend"
@
input.stop
@
input.stop
=
"_input"
@
focus=
"_focus"
@
focus=
"_focus"
@
blur=
"_blur"
@
blur=
"_blur"
@
touchstart.passive=
"_touchstart"
@
touchstart.passive=
"_touchstart"
@
scroll.passive=
"_scroll"
/>
/>
</div>
</div>
</uni-textarea>
</uni-textarea>
</
template
>
</
template
>
...
@@ -101,6 +108,7 @@ export default {
...
@@ -101,6 +108,7 @@ export default {
data
()
{
data
()
{
return
{
return
{
valueSync
:
String
(
this
.
value
),
valueSync
:
String
(
this
.
value
),
valueComposition
:
''
,
composition
:
false
,
composition
:
false
,
focusSync
:
this
.
focus
,
focusSync
:
this
.
focus
,
height
:
0
,
height
:
0
,
...
@@ -123,6 +131,9 @@ export default {
...
@@ -123,6 +131,9 @@ export default {
selectionEndNumber
()
{
selectionEndNumber
()
{
var
selectionEnd
=
Number
(
this
.
selectionEnd
)
var
selectionEnd
=
Number
(
this
.
selectionEnd
)
return
isNaN
(
selectionEnd
)
?
-
1
:
selectionEnd
return
isNaN
(
selectionEnd
)
?
-
1
:
selectionEnd
},
valueCompute
()
{
return
(
this
.
composition
?
this
.
valueComposition
:
this
.
valueSync
).
split
(
'
\n
'
)
}
}
},
},
watch
:
{
watch
:
{
...
@@ -185,7 +196,9 @@ export default {
...
@@ -185,7 +196,9 @@ export default {
},
},
mounted
()
{
mounted
()
{
this
.
$refs
.
textarea
.
value
=
this
.
valueSync
this
.
$refs
.
textarea
.
value
=
this
.
valueSync
this
.
_computeHeight
()
this
.
_resize
({
height
:
this
.
$refs
.
sensor
.
$el
.
offsetHeight
})
},
},
beforeDestroy
()
{
beforeDestroy
()
{
this
.
$dispatch
(
'
Form
'
,
'
uni-form-group-update
'
,
{
this
.
$dispatch
(
'
Form
'
,
'
uni-form-group-update
'
,
{
...
@@ -194,11 +207,6 @@ export default {
...
@@ -194,11 +207,6 @@ export default {
})
})
},
},
methods
:
{
methods
:
{
_computeHeight
()
{
this
.
$nextTick
(()
=>
{
this
.
height
=
this
.
$refs
.
textarea
.
scrollHeight
})
},
_focus
:
function
(
$event
)
{
_focus
:
function
(
$event
)
{
this
.
focusSync
=
true
this
.
focusSync
=
true
this
.
$trigger
(
'
focus
'
,
$event
,
{
this
.
$trigger
(
'
focus
'
,
$event
,
{
...
@@ -243,8 +251,13 @@ export default {
...
@@ -243,8 +251,13 @@ export default {
_touchstart
()
{
_touchstart
()
{
this
.
focusChangeSource
=
'
touch
'
this
.
focusChangeSource
=
'
touch
'
},
},
_scroll
()
{
_resize
({
height
})
{
this
.
_computeHeight
()
this
.
height
=
height
},
_input
(
$event
)
{
if
(
this
.
composition
)
{
this
.
valueComposition
=
$event
.
target
.
value
}
},
},
_getFormData
()
{
_getFormData
()
{
return
{
return
{
...
@@ -284,6 +297,7 @@ uni-textarea {
...
@@ -284,6 +297,7 @@ uni-textarea {
color
:
inherit
;
color
:
inherit
;
}
}
.uni-textarea-placeholder
,
.uni-textarea-placeholder
,
.uni-textarea-compute
,
.uni-textarea-textarea
{
.uni-textarea-textarea
{
box-sizing
:
border-box
;
box-sizing
:
border-box
;
position
:
absolute
;
position
:
absolute
;
...
@@ -305,6 +319,10 @@ uni-textarea {
...
@@ -305,6 +319,10 @@ uni-textarea {
.uni-textarea-placeholder
{
.uni-textarea-placeholder
{
color
:
grey
;
color
:
grey
;
}
}
.uni-textarea-compute
{
visibility
:
hidden
;
height
:
auto
;
}
.uni-textarea-textarea
{
.uni-textarea-textarea
{
outline
:
none
;
outline
:
none
;
border
:
none
;
border
:
none
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录