javascript - 为什么我在 ASP.Net 中的cropper.js 文件上收到 404 错误,尽管它们正是程序正在寻找它们的位置?
问题描述
在尝试将cropper.js导入到我的ASP.Net 项目中时,我复制并粘贴了为实现它而给出的示例代码。但是,每当加载页面时,我都会收到来自主cropper.js 文件的一系列 404 错误,表示未找到其他 javascript 文件。我确保它们位于 Scripts/cropperjs/src/js 中,这是 404 错误的来源。我需要做什么才能让这些文件被识别?
这是我在页面上的确切代码:
<script type="module">
import 'cropperjs/dist/cropper.css';
import Cropper from 'cropper.js';
const image = document.getElementById('cropperJS');
const cropper = new Cropper(image, {
aspectRatio: 16 / 9,
crop(event) {
console.log(event.detail.x);
console.log(event.detail.y);
console.log(event.detail.width);
console.log(event.detail.height);
console.log(event.detail.rotate);
console.log(event.detail.scaleX);
console.log(event.detail.scaleY);
},
});
</script>
解决方案
您是否已将以下几行添加到您的<head>
部分?
<link href="/path/to/cropper.css" rel="stylesheet">
<script src="/path/to/cropper.js"></script>
推荐阅读
- sql - 如何将“ALTER table [...] ADD column”之类的更改记录到我的 PostgreSQL 表中?
- node.js - 角度2:成功登录后无法重定向到主页
- angular - 当我将 rxjs 从 6.3.3 更新到 6.4.0 时,出现错误:ERROR TypeError: You provide an invalid object where a stream is expected
- scala - 如何在 Spark 应用程序中进行有效的日志记录
- javascript - ThreeJS 我的 GLTF 加载速度在主机服务器上太慢了?
- linux - 如何设置 GNU 缩进输入
- slim-4 - 如何在 Slim Framework 4 中获取已注册的路由
- javascript - 如何在渲染函数上方使用更新的状态值?
- python - Django:移动计算查询集,远离 Python 代码
- jquery - 在 JQuery 中将日期范围转换为单独的数字日期