게시물 미리보기 기능 추가

This commit is contained in:
2026-05-03 10:18:22 +09:00
parent 8c5ccc94ec
commit e506a343bc
11 changed files with 123 additions and 12 deletions

View File

@@ -14,7 +14,7 @@ const props = defineProps({
}
})
const emit = defineEmits(['submit'])
const emit = defineEmits(['submit', 'preview'])
const autosaveStoragePrefix = 'SORI_ADMIN_POST_AUTOSAVE'
const slugTouched = ref(Boolean(props.initialPost.slug))
@@ -414,6 +414,14 @@ const submitPost = () => {
emit('submit', createPostPayload())
}
/**
* 게시물 미리보기 요청
* @returns {void}
*/
const previewPost = () => {
emit('preview', createPostPayload())
}
watch(form, scheduleAutosave, { deep: true })
onMounted(() => {
@@ -669,6 +677,13 @@ defineExpose({
<NuxtLink class="admin-post-form__cancel rounded border border-line bg-white px-4 py-2 text-sm font-semibold" to="/admin/posts">
취소
</NuxtLink>
<button
class="admin-post-form__preview rounded border border-line bg-white px-4 py-2 text-sm font-semibold"
type="button"
@click="previewPost"
>
미리보기
</button>
<button
class="admin-post-form__submit rounded bg-[#15171a] px-4 py-2 text-sm font-semibold text-white disabled:opacity-50"
type="submit"