如何解决CDN -filepond 在我的项目中使用 node-js、express、e.j.s-layouts 并且无法获得 image__preview 我使用 CDN 来安装 filepond
我尝试使用 filepond。我使用 cdn 在我的 ejs mainlayout.ejs 文件中安装了 filepond 和图像预览插件。 代码是。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<link
href="https://unpkg.com/filepond/dist/filepond.css"
rel="stylesheet"
/>
<link
href="https://unpkg.com/filepond-plugin-image-preview/dist/filepond-plugin-image-preview.css"
rel="stylesheet"
/>
<script
defer
src="https://unpkg.com/filepond-plugin-image-preview/dist/filepond-plugin-image-preview.js"
></script>
<script
defer
src="https://unpkg.com/filepond-plugin-image-resize/dist/filepond-plugin-image-resize.js"
></script>
<script
defer
src="https://unpkg.com/filepond-plugin-file-encode/dist/filepond-plugin-file-encode.js"
></script>
<script defer src="https://unpkg.com/filepond/dist/filepond.js"></script>
<script src="javaScripts/fileUplodes.js"></script>
<title>books</title>
<style>
body {
background-color: rgba(190,186,180,0.288);
}
</style>
</head>
<body>
<div class="container">
这是我的头部标签。
有 3 种安装 filepond 的方法。
- npm,
- cdn,
- 嵌入文件。
在cdn中。 我给了 css 链接
<link
href="https://unpkg.com/filepond/dist/filepond.css"
rel="stylesheet"
/>
<link
href="https://unpkg.com/filepond-plugin-image-preview/dist/filepond-plugin-image-preview.css"
rel="stylesheet"
/>
我也给了脚本标签。
<script
defer
src="https://unpkg.com/filepond-plugin-image-preview/dist/filepond-plugin-image-preview.js"
></script>
<script defer src="https://unpkg.com/filepond/dist/filepond.js"></script>
我使用另一个js文件来注册插件和解析。
FilePondPluginImagePreview,FilePondPluginImageResize,FilePondPluginFileEncode
);
console.log("filepond registed.....")
FilePond.parse(document.body);
我以文档中给出的形式为输入文件提供了一类文件池。
<form action="/books" method="POST" enctype="multipart/form-data">
<label>cover image:</label>
<input type="file" name="cover" class="filepond"/>
<br />
</form>
我什至尝试使用。
const input = document.querySelector("input[type='file']");
const pond = FilePond.create(input);
没有变化。 如果我做错了,请纠正。 这是 git 仓库 enter link description here
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。