fix: youhua
This commit is contained in:
@@ -20,10 +20,13 @@
|
||||
class="comment-input"
|
||||
type="text"
|
||||
v-model="commentText"
|
||||
:disabled="sending"
|
||||
placeholder="说点什么吧..."
|
||||
placeholder-class="input-placeholder"
|
||||
/>
|
||||
<button class="send-btn" @tap="handleSend">发送</button>
|
||||
<button class="send-btn" :class="{ 'is-disabled': sending }" :disabled="sending" @tap="handleSend">
|
||||
{{ sending ? '发送中...' : '发送' }}
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@@ -35,6 +38,10 @@ const props = defineProps({
|
||||
initialAction: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
sending: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
});
|
||||
|
||||
@@ -62,19 +69,28 @@ const handleAction = (action) => {
|
||||
};
|
||||
|
||||
const handleSend = () => {
|
||||
if (!commentText.value.trim()) {
|
||||
const content = commentText.value.trim();
|
||||
if (!content) {
|
||||
uni.showToast({
|
||||
title: '请输入评论内容',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (props.sending) return;
|
||||
emit('send-comment', {
|
||||
action: currentAction.value,
|
||||
content: commentText.value
|
||||
content
|
||||
});
|
||||
commentText.value = ''; // 发送后清空
|
||||
};
|
||||
|
||||
const resetComment = () => {
|
||||
commentText.value = '';
|
||||
};
|
||||
|
||||
defineExpose({
|
||||
resetComment
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@@ -162,7 +178,11 @@ const handleSend = () => {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.send-btn.is-disabled {
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.send-btn::after {
|
||||
border: none;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user