我想知道为什么我的网站没有出现在 Edge 上?它是在 JavaScript 上开发的
I would like to know why my website is not showing up on Edge? it's developed on JavaScript
有人告诉我 Edge 不支持这个“...”。以下代码存在兼容性问题,网站无法显示。
代码如下:
//<< Mapping hash
hash = {
route: hash[0].split(/\//)[0],
params: hash[0].split(/\//).slice(1),
queryParams: hash.length > 1 ? hash[1] : "",
}
hash.queryParams = hash.queryParams?hash.queryParams.split(/&/).reduce((a, c, i) => {
return {...a,...{[c.split(/=/)[0]]: c.split(/=/)[1]}}
}, {}):{}; // I got to fix this (Reynald - 12: 35 pm)
//>>
问题特别在hash.queryParams = ...
.
我将拆分完整的函数及其 属性 和其中使用的每个方法。我知道我会得到一个更大的方式,这样 Edge 就不会在阅读网站时遇到任何问题。
hash.queryParams = hash.queryParams?hash.queryParams.split(/&/).reduce((a, c, i) => {
return {...a,...{[c.split(/=/)[0]]: c.split(/=/)[1]}}
}, {}):{}; // I got to fix this (Reynald - 12: 35 pm)```
目前有任何事情。输出是网站应该从一个外部文件呈现,该文件有一个 JavaScript 在 index.html 上绘制网站,我的意思是例如 main.js 正在绘制index.html 和 main.js 有连接调用每个独立页面与每个相应的文件。
传播运算符似乎是 not supported in Edge for destructuring, so whoever told you that was correct. Unless you want to deal with transpiling your code, you can try using Object.assign()。
将 return {...a,...{[c.split(/=/)[0]]: c.split(/=/)[1]}}
替换为:
return Object.assign(a, {[c.split(/=/)[0]]: c.split(/=/)[1]})
有人告诉我 Edge 不支持这个“...”。以下代码存在兼容性问题,网站无法显示。
代码如下:
//<< Mapping hash
hash = {
route: hash[0].split(/\//)[0],
params: hash[0].split(/\//).slice(1),
queryParams: hash.length > 1 ? hash[1] : "",
}
hash.queryParams = hash.queryParams?hash.queryParams.split(/&/).reduce((a, c, i) => {
return {...a,...{[c.split(/=/)[0]]: c.split(/=/)[1]}}
}, {}):{}; // I got to fix this (Reynald - 12: 35 pm)
//>>
问题特别在hash.queryParams = ...
.
我将拆分完整的函数及其 属性 和其中使用的每个方法。我知道我会得到一个更大的方式,这样 Edge 就不会在阅读网站时遇到任何问题。
hash.queryParams = hash.queryParams?hash.queryParams.split(/&/).reduce((a, c, i) => {
return {...a,...{[c.split(/=/)[0]]: c.split(/=/)[1]}}
}, {}):{}; // I got to fix this (Reynald - 12: 35 pm)```
目前有任何事情。输出是网站应该从一个外部文件呈现,该文件有一个 JavaScript 在 index.html 上绘制网站,我的意思是例如 main.js 正在绘制index.html 和 main.js 有连接调用每个独立页面与每个相应的文件。
传播运算符似乎是 not supported in Edge for destructuring, so whoever told you that was correct. Unless you want to deal with transpiling your code, you can try using Object.assign()。
将 return {...a,...{[c.split(/=/)[0]]: c.split(/=/)[1]}}
替换为:
return Object.assign(a, {[c.split(/=/)[0]]: c.split(/=/)[1]})