Uncaught ReferenceError: Ext is not defined

本文介绍了ExtJS初学者常遇的问题及解决方法,包括引入文件的顺序调整和避免文件冲突等,帮助读者快速上手ExtJS。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

出于项目需要得学点ExtJS(版本是extjs 3.2),按照网上的教程创建了第一个使用extjs的html文件,浏览器打开后一片空白,F12查看控制台,报错,Uncaught ReferenceError: Ext is not defined。



原因是没有引入ext-base.js或者ext-base.js的顺序不对,ext-base.js必须在ext-all.js前面引入。引入ext-base.js并调整引入的顺序后,代码如下:

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>ExtJs</title>
	<link href="ExtJs/resources/css/ext-all.css" rel="stylesheet" type="text/css" />
	<script type="text/javascript" src="ExtJs/ext-base.js"></script>
	<script type="text/javascript" src="ExtJs/ext-all.js"></script>
    <script type="text/javascript" src="ExtJs/ext-all-debug-w-comments.js" type="text/javascript"></script>    
	
</head>
<body>
    <div>
    <script type="text/javascript">
        Ext.onReady(function () {
            Ext.MessageBox.alert('标题', 'Hello World!');
        });
    </script>
    </div>
</body>
</html>

再次打开页面,F12没有报错但是页面还是一片空白。排查后觉得是ext-all.js和ext-all-debug-w-comments.js冲突了,删除这两句的任一一句,两个引入其中一个就够了,刷新就能够显示页面了。

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>ExtJs</title>
	<link href="ExtJs/resources/css/ext-all.css" rel="stylesheet" type="text/css" />
	<script type="text/javascript" src="ExtJs/ext-base.js"></script>
	<script type="text/javascript" src="ExtJs/ext-all.js"></script> 
	
</head>
<body>
    <div>
    <script type="text/javascript">
        Ext.onReady(function () {
            Ext.MessageBox.alert('标题', 'Hello World!');
        });
    </script>
    </div>
</body>
</html>


刚入门就遇到不显示页面也不报错误信息的,折腾,还是做下记录,供以后自己和他人参考吧。



``` <link href="https://unpkg.com/filepond/dist/filepond.css" rel="stylesheet"> <!-- 核心库必须最先加载 --> <script src="https://unpkg.com/filepond/dist/filepond.js"></script> <!-- 然后加载插件 --> <script src="https://unpkg.com/filepond-plugin-image-preview/dist/filepond-plugin-image-preview.js"></script> <script src="https://unpkg.com/filepond-plugin-image-edit/dist/filepond-plugin-image-edit.js"></script> <script src="https://unpkg.com/filepond-plugin-file-rename/dist/filepond-plugin-file-rename.js"></script> <script src="https://unpkg.com/filepond-plugin-image-crop/dist/filepond-plugin-image-crop.js"></script> <script src="https://unpkg.com/filepond-plugin-image-resize/dist/filepond-plugin-image-resize.js"></script> </style> <script> // 注册插件 FilePond.registerPlugin( FilePondPluginImagePreview, FilePondPluginImageEdit, FilePondPluginFileRename, FilePondPluginImageCrop, FilePondPluginImageResize ); // 初始化配置 const pond = FilePond.create(document.querySelector('.filepond'), { imageResizeTargetWidth: 1920, imageResizeTargetHeight: 770, imageResizeMode: 'cover', // 裁剪模式 imageEditEditor: ImageEditor, stylePanelAspectRatio: 1920/770, // 保持比例 allowImageCrop: true, fileRenameFunction: (file) => { const ext = file.extension; return `image_${Date.now()}_${Math.random().toString(36).substr(2, 9)}${ext}`; } }); // 表单提交处理 document.getElementById('WSSliderForm').addEventListener('submit', async (e) => { e.preventDefault(); // 先上传文件 await pond.processFiles();```Uncaught ReferenceError: ImageEditor is not defined
最新发布
03-18
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值