当我浏览http://localhost:8080/create 时,它工作正常,但是当浏览http://localhost:8080/create/344或http://localhost:8080/edit/224 时,我收到此错误:
拒绝应用来自“ http://localhost:8080/edit/dist/main.css ”的样式,因为它的 MIME 类型(“text/html”)不是受支持的样式表 MIME 类型,并且启用了严格的 MIME 检查。
2345:12 GET http://localhost:8080/edit/dist/bundle.js 404(未找到)345:1
拒绝执行来自“ http://localhost:8080/editt/dist/bundle.js ”的脚本,因为它的 MIME 类型(“text/html”)不可执行,并且启用了严格的 MIME 类型检查。
这是我的代码:
<BrowserRouter>
<Switch>
<Route exact={true} path="/" component={Dashboard} />
<Route path="/edit/:id" component={EditPost}/>
<Route path="/create" component={AddPost} />
<Route component={NotFoundPage}/>
</Switch>
</BrowserRouter>
Run Code Online (Sandbox Code Playgroud)
请检查此屏幕截图:
这是我的 webpack 配置文件:https : //pastebin.com/d5vx8niQ项目文件:https ://drive.google.com/file/d/1IYcuJTbklXYi53XvIcNRJtb-tLOO4g1j/view?usp = sharing
我有一个带有一些数组项的对象,现在我必须计算所有项的长度.我有一个想法来计算这些项目,我声明count = 0变量,然后计算这些项目的长度并添加count变量.
var obj = {
item_1: ['item1', 'item2', 'item3', 'item4'],
item_2: ['item1', 'item2', 'item3', 'item4', 'item5'],
item_3: ['item1', 'item2', 'item3']
}
var count = 0;
Object.entries(obj).map(item => {
count += item[1].length
})
console.log(count)Run Code Online (Sandbox Code Playgroud)
我的问题是:如何在不声明calculate变量的情况下获得此结果?例:console.log(Object.entries(Obj)....?)
我有一个包含 Unicode 数据的数组,例如var data = ["1F923", "1F603"]
如何将 Unicode 转换为表情符号?
如果我"\u{1F923}"在控制台中使用,它会返回一个表情符号,但如果我使用"\u{"+ data[0] +"}",它会返回一个错误。任何人都可以帮我将 unicode 转换为表情符号。
javascript ×3
arrays ×1
console ×1
console.log ×1
emoji ×1
html ×1
node.js ×1
object ×1
react-router ×1
reactjs ×1
unicode ×1