编辑:这是一个拼写错误 - 我错误地使用了脚本而不是链接并且没有注意到。因为已经给出了正确答案,所以即使很傻我也不会删题。我只会接受答案。
我正在尝试学习 ExtJS。 我在下面写了简单的代码。我添加了 neptune 主题 css 文件以便为我的组件设置样式,但出现以下错误:
Uncaught SyntaxError: Invalid or unexpected token
错误发生在上述文件中的导入处:
@import 'theme-neptune-all_1.css';
@import 'theme-neptune-all_2.css';
我做错了什么?
<!DOCTYPE html>
<html>
<head>
<script type = "text/javascript"
src = "ext-6.6.0-trial/build/classic/theme-neptune/resources/theme-neptune-all.css"></script>
<script type = "text/javascript"
src = "ext-6.6.0-trial/build/ext-all.js"></script>
<script type = "text/javascript">
Ext.onReady(function() {
Ext.create('Ext.Panel', {
renderTo: 'helloWorldPanel',
height: 200,
width: '50%',
title: 'Hello world',
html: 'First Ext JS Hello World Program'
});
});
</script>
</head>
<body>
<div id = "helloWorldPanel" />
</body>
</html>
最佳答案
你做错的是告诉浏览器它要读取 javascript,然后给它 CSS。您希望使用 link
元素而不是 script
标签加载 CSS。
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link
关于css - 未捕获的语法错误 : Invalid or unexpected token @import css,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53132108/