修正comments

This commit is contained in:
Last
2025-04-21 20:12:50 +08:00
parent 48bea6d521
commit a3d98b3c63

View File

@@ -258,7 +258,7 @@ onMounted(() => {
// 展示组件 // 展示组件
const comments = ref({ const comments = ref({
edit: { id: '', content: '', namne: '', email: '' }, edit: { id: '', content: '', name: '', email: '' },
item: computed(() => data.value.find(x => x.id === comments.value.edit.id)), item: computed(() => data.value.find(x => x.id === comments.value.edit.id)),
// 提交评论内容 // 提交评论内容
async submit() { async submit() {
@@ -283,7 +283,7 @@ const comments = ref({
} }
}) })
const create = (event) => { export const create = (event) => {
$fetch("/api/blog", { $fetch("/api/blog", {
method: "POST", method: "POST",
body: JSON.stringify({ content: content.value }), body: JSON.stringify({ content: content.value }),
@@ -297,12 +297,12 @@ const create = (event) => {
}); });
}; };
const onChanged = () => { export const onChanged = () => {
console.log('onChanged', content.value); console.log('onChanged', content.value);
}; };
// 获取 textarea 中的内容高度, 并使输入框高度跟随内容高度变化 // 获取 textarea 中的内容高度, 并使输入框高度跟随内容高度变化
const onEnter = (event) => { export const onEnter = (event) => {
const textarea = event.target; const textarea = event.target;
textarea.style.height = textarea.scrollHeight + 'px'; textarea.style.height = textarea.scrollHeight + 'px';
return true return true