|
|
@ -34,40 +34,64 @@ async function submit() { |
|
|
</script> |
|
|
</script> |
|
|
|
|
|
|
|
|
<template> |
|
|
<template> |
|
|
<UContainer class="py-8 max-w-3xl space-y-4"> |
|
|
<UContainer class="py-8 max-w-6xl space-y-6"> |
|
|
<h1 class="text-2xl font-semibold"> |
|
|
<div class="flex flex-wrap items-center justify-between gap-3"> |
|
|
新建文章 |
|
|
<h1 class="text-2xl font-semibold tracking-tight"> |
|
|
</h1> |
|
|
新建文章 |
|
|
<UForm :state="state" class="space-y-4" @submit.prevent="submit"> |
|
|
</h1> |
|
|
<UFormField label="标题" name="title" required> |
|
|
<UButton to="/me/posts" variant="ghost" color="neutral"> |
|
|
<UInput v-model="state.title" /> |
|
|
返回列表 |
|
|
</UFormField> |
|
|
</UButton> |
|
|
<UFormField label="slug" name="slug" required> |
|
|
</div> |
|
|
<UInput v-model="state.slug" /> |
|
|
|
|
|
</UFormField> |
|
|
<UForm :state="state" class="space-y-6" @submit.prevent="submit"> |
|
|
<UFormField label="摘要" name="excerpt" required> |
|
|
<UCard :ui="{ body: 'p-4 sm:p-6' }"> |
|
|
<UInput v-model="state.excerpt" /> |
|
|
<PostBodyMarkdownEditor v-model="state.bodyMarkdown" /> |
|
|
</UFormField> |
|
|
<UFormField label="正文" name="bodyMarkdown" required class="sr-only" /> |
|
|
<UFormField label="正文 Markdown" name="bodyMarkdown" required> |
|
|
</UCard> |
|
|
<UTextarea v-model="state.bodyMarkdown" :rows="16" class="w-full font-mono text-sm" /> |
|
|
|
|
|
</UFormField> |
|
|
<UCard :ui="{ body: 'p-4 sm:p-6 space-y-4' }"> |
|
|
<UFormField label="可见性" name="visibility"> |
|
|
<UCollapsible :unmount-on-hide="false" :default-open="true"> |
|
|
<USelect |
|
|
<UButton |
|
|
v-model="state.visibility" |
|
|
type="button" |
|
|
:items="[ |
|
|
color="neutral" |
|
|
{ label: '私密', value: 'private' }, |
|
|
variant="subtle" |
|
|
{ label: '公开', value: 'public' }, |
|
|
block |
|
|
{ label: '仅链接', value: 'unlisted' }, |
|
|
class="justify-between font-medium" |
|
|
]" |
|
|
label="文章设置" |
|
|
/> |
|
|
trailing |
|
|
</UFormField> |
|
|
trailing-icon="i-lucide-chevron-down" |
|
|
<div class="flex gap-2"> |
|
|
/> |
|
|
|
|
|
<template #content> |
|
|
|
|
|
<div class="pt-4 space-y-4 border-t border-default mt-4"> |
|
|
|
|
|
<UFormField label="标题" name="title" required> |
|
|
|
|
|
<UInput v-model="state.title" /> |
|
|
|
|
|
</UFormField> |
|
|
|
|
|
<UFormField label="slug" name="slug" required> |
|
|
|
|
|
<UInput v-model="state.slug" /> |
|
|
|
|
|
</UFormField> |
|
|
|
|
|
<UFormField label="摘要" name="excerpt" required> |
|
|
|
|
|
<UInput v-model="state.excerpt" /> |
|
|
|
|
|
</UFormField> |
|
|
|
|
|
<UFormField label="可见性" name="visibility"> |
|
|
|
|
|
<USelect |
|
|
|
|
|
v-model="state.visibility" |
|
|
|
|
|
:items="[ |
|
|
|
|
|
{ label: '私密', value: 'private' }, |
|
|
|
|
|
{ label: '公开', value: 'public' }, |
|
|
|
|
|
{ label: '仅链接', value: 'unlisted' }, |
|
|
|
|
|
]" |
|
|
|
|
|
/> |
|
|
|
|
|
</UFormField> |
|
|
|
|
|
</div> |
|
|
|
|
|
</template> |
|
|
|
|
|
</UCollapsible> |
|
|
|
|
|
</UCard> |
|
|
|
|
|
|
|
|
|
|
|
<div class="flex flex-wrap gap-2"> |
|
|
<UButton type="submit" :loading="loading"> |
|
|
<UButton type="submit" :loading="loading"> |
|
|
创建 |
|
|
创建 |
|
|
</UButton> |
|
|
</UButton> |
|
|
<UButton to="/me/posts" variant="ghost" color="neutral"> |
|
|
|
|
|
返回 |
|
|
|
|
|
</UButton> |
|
|
|
|
|
</div> |
|
|
</div> |
|
|
</UForm> |
|
|
</UForm> |
|
|
</UContainer> |
|
|
</UContainer> |
|
|
|