我正在对记录进行编辑的laravel视图,该记录具有与之相关的图像,并且我需要它预先显示在输入文件中,以便在您提交时发送相同的图像,或者是否需要改变它。
// Turn input element into a pond
FilePond.registerPlugin(
FilePondPluginFileEncode,
FilePondPluginImagePreview,
FilePondPluginImageExifOrientation,
FilePondPluginFileValidateSize
);
var imagen = '{{ trim($marca->imagen_asociada) }}'
const inputElement = document.querySelector('input[type="file"]');
FilePond.setOptions({
server: {
load: imagen.replace('/images/button/','')
}
});
const pond = FilePond.create(inputElement,{
files: [
{
source: '{{ public_path().'/resources'.trim($marca->imagen_asociada) }}',
options: {
type: 'local',
// mock file information
file: {
name: imagen.replace('/images/button/',''),
}
}
}
]
});
现在像这样显示
我遇到了同样的问题,此问题已解决:
/*FilePond.setOptions({
server: {
load: imagen.replace('/images/button/','')
}
}); Remove this.*/
const pond = FilePond.create(inputElement,{
files: [
{
source: '{{ public_path().'/resources'.trim($marca->imagen_asociada) }}',
/*options: {
type: 'local',
// mock file information
file: {
name: imagen.replace('/images/button/',''),
}
} - Remove this options {} dictionary */
}
]
});
根据文档“设置初始文件”下