【问题标题】:I can't load images from Flamelink that is integrated with Firebase and Vue我无法从与 Firebase 和 Vue 集成的 Flamelink 加载图像
【发布时间】:2020-09-26 11:21:49
【问题描述】:

现在,该代码适用于我传递的所有字符串,但是,我无法从存储中检索我的图像并查看所需的 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>

Check this link to see what data is passed in the src of the img tag

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

【问题讨论】:

  • 请不要发布代码图片,您需要将该代码以文本格式包含在问题中。

标签: javascript vue.js google-cloud-firestore firebase-storage flamelink-cms


【解决方案1】:

您可以执行以下操作

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/....."
}]

然后您可以像这样访问网址

this.teamPage.executiveBoard[0].image[0].url

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-01-20
    • 1970-01-01
    • 1970-01-01
    • 2021-10-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多