|
|
|
@ -1,15 +1,19 @@
|
|
|
|
|
<template> |
|
|
|
|
<view class="view"> |
|
|
|
|
<view |
|
|
|
|
class="" |
|
|
|
|
class="input-wrapper" |
|
|
|
|
style=" |
|
|
|
|
background-color: #f9f9f9; |
|
|
|
|
border: 1px solid #f1f1f4; |
|
|
|
|
border-radius: 24rpx; |
|
|
|
|
padding: 16rpx; |
|
|
|
|
height: 400rpx; |
|
|
|
|
position: relative; |
|
|
|
|
" |
|
|
|
|
@tap="focusInput" |
|
|
|
|
> |
|
|
|
|
<uni-easyinput |
|
|
|
|
ref="easyInput" |
|
|
|
|
type="textarea" |
|
|
|
|
v-model="introduce" |
|
|
|
|
placeholder="请输入..." |
|
|
|
@ -19,12 +23,15 @@
|
|
|
|
|
:adjust-position="true" |
|
|
|
|
:autoHeight="true" |
|
|
|
|
cursorSpacing="32" |
|
|
|
|
@blur="textAreaFocus = false" |
|
|
|
|
:focus="textAreaFocus" |
|
|
|
|
:styles="{ |
|
|
|
|
backgroundColor: 'transparent', |
|
|
|
|
borderColor: 'none' |
|
|
|
|
borderColor: 'none', |
|
|
|
|
height: '360rpx' |
|
|
|
|
}" |
|
|
|
|
></uni-easyinput> |
|
|
|
|
<view style="color: #78829d; text-align: right"> |
|
|
|
|
<view class="word-count"> |
|
|
|
|
{{ introduce.length }}/500 |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
@ -40,13 +47,26 @@
|
|
|
|
|
export default { |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
introduce: '' |
|
|
|
|
introduce: '', |
|
|
|
|
textAreaFocus: false |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
onLoad(res) { |
|
|
|
|
this.introduce = res.introduce |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
// 聚焦输入框 |
|
|
|
|
focusInput() { |
|
|
|
|
console.log(this.$refs) |
|
|
|
|
if (this.$refs.easyInput) { |
|
|
|
|
this.textAreaFocus = false // 先重置焦点状态 |
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
this.textAreaFocus = true // 在下一个时序重新设置焦点 |
|
|
|
|
}) |
|
|
|
|
} else { |
|
|
|
|
console.warn('输入框组件未注册') |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
submit() { |
|
|
|
|
if (!this.introduce) { |
|
|
|
|
uni.showToast({ |
|
|
|
@ -77,6 +97,11 @@ export default {
|
|
|
|
|
background-color: #f9f9f9 !important; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
.input-wrapper { |
|
|
|
|
min-height: 400rpx; |
|
|
|
|
height: auto !important; |
|
|
|
|
transition: height 0.3s ease; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.operation { |
|
|
|
|
padding: 12px; |
|
|
|
@ -97,4 +122,15 @@ export default {
|
|
|
|
|
color: #fff; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
.word-count { |
|
|
|
|
position: absolute; |
|
|
|
|
bottom: 0; |
|
|
|
|
right: 16rpx; |
|
|
|
|
color: #78829d; |
|
|
|
|
font-size: 24rpx; |
|
|
|
|
background-color: #f9f9f9; |
|
|
|
|
padding: 4rpx 8rpx; |
|
|
|
|
transform: translateY(100%); |
|
|
|
|
margin-bottom: 40rpx; |
|
|
|
|
} |
|
|
|
|
</style> |
|
|
|
|