1

现在,该代码适用于我传递的所有字符串,但是,我无法从存储中检索我的图像并查看所需的 fieldId。我遵循了 flamelink-js-sdk 的文档,但它似乎并没有说明应该对图像做什么。

这是我的代码示例:

async created() {
app.content
  .get({
    schemaKey: "teamPage",
    populate: [
      {
        field: "title"
      },
      {
        field: "description"
      },
      {
        field: "executiveBoard",
        fields: [
          "title",
          "position",
          "image",
          "facebook",
          "github",
          "linkedin"
        ]
      }
    ]
  })
  .then(teamPage => {
    this.teamPage = teamPage;
    console.log(this.teamPage.executiveBoard[0].image);
  })
  .catch(error => console.log(error));},

这是我渲染它们的地方

 <team-circle
        v-for="board in teamPage.executiveBoard"
        :key="board.title"
        class="col-12 col-sm-12 col-md-4"
        :name="board.title"
        :image="board.image"
        :facebook="board.facebook"
        :linkedin="board.linkedin"
        :github="board.github"
      >{{ board.position }}</team-circle>

查看此链接,查看 img 标签的 src 中传递了哪些数据

再次感谢你。希望你能帮助我解决这个问题!

4

1 回答 1

0

您可以执行以下操作

app.content
  .get({
    schemaKey: "teamPage",
    populate: [
      {
        field: "title"
      },
      {
        field: "description"
      },
      {
        field: "executiveBoard",
        fields: [
          "title",
          "position",
          "image",
          "facebook",
          "github",
          "linkedin"
        ],
        populate: ["image"]
      }
    ]
  })

注意populate: ["image"]添加(见this

this.teamPage.executiveBoard[0].image现在将是一个对象数组示例

[{ 
  contentType: "image/png",
  id: "xxx",
  ...
  url: "https://firebasestorage.googleapis.com/v0/b/....."
}]

然后,您可以像这样访问 url

this.teamPage.executiveBoard[0].image[0].url
于 2020-11-11T12:50:56.190 回答