我如何在 strapi 中保存为草稿?

How do I save as draft in strapi?

目前我已经设法 post 进入 strapi,但我无法将 post 状态设置为草稿。我正在使用 graphql,并且突变中没有 post 状态。我必须做什么?

谢谢。

您使用的是哪个版本的 Strapi?

最近发布了草稿和发布功能。你绝对应该试一试:https://strapi.io/blog/announcing-a-new-draft-and-publish-feature

我发现的方法是在执行突变时将 属性 publised_at 作为 null 传递。

publised_at 是 strapi 分配给每个集合的默认 属性。

查询

mutation CreateRecord (
  $recordName: String!,
  $published_at: DateTime
) {
  createComment (input: {
    data : {
      recordName: $recordName,
      publised_at: $published_at
    }
  })
}

什么时候发送值

createRecords({
  variables: {
    recordName: "I am a new record saved as draft"
    published_at: null
  }
});