fix: youhua

This commit is contained in:
zzc
2026-06-10 01:24:41 +08:00
parent 1e5bbbbf9e
commit aa88eef08e
3 changed files with 164 additions and 26 deletions

View File

@@ -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>