Filepond 在渲染圖像之前新增身份驗證標頭
P粉201448898
P粉201448898 2024-03-27 13:06:23
0
1
400

我在我的 Vue 應用程式中使用 filepond 外掛程式。它非常適合我的應用程式要求。 目前我的後端服務正在透過 JWT 身份驗證提供映像。 如何向文件池添加自訂標頭以載入元件中的圖像?

以下是我所取得的成就

<file-pond
    ref="file"
    name="filepond"
    :label-idle="placeholder"
    accepted-file-types="image/jpeg, image/png"
    drop-validation="true"
    style-panel-layout="compact circle"
    style-button-remove-item-position="center bottom"
    style-panel-aspect-ratio="1:1"
    :allow-image-crop="true"
    image-crop-aspect-ratio="1:1"
    :files="src"
    :server="{
      url: 'http://192.168.0.100',

      load: {
        url: './process',
        method: 'GET',
        headers: {
          'x-customheader': 'Hello World'
        },
        withCredentials: false
      }
    }"
  />

即使在安裝元件之後,伺服器選項仍然不會被調用,並且我的圖像會拋出 401 錯誤

P粉201448898
P粉201448898

全部回覆(1)
P粉378264633

這就是您正在尋找的東西。 為了呈現遠端圖像 url,您需要為其提供額外的圖像屬性,在本例中為 local

詳細閱讀此處 - https://pqina.nl/filepond /docs/api/instance/properties/#files

熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!