我想知道为什么我的网站没有显示在Edge上?它是用JavaScript开发的 [英] I would like to know why my website is not showing up on Edge? it's developed on JavaScript

查看:82
本文介绍了我想知道为什么我的网站没有显示在Edge上?它是用JavaScript开发的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人告诉我Edge不支持此"...".以下代码中的某些内容存在兼容性问题,并且网站没有显示.

Thing is someone told me that this "..." is not supported on Edge. There's something with the following code that has compatibility problems and the website is not showing up.

代码如下:

    //<< 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在阅读网站时不会出现任何问题.

I'm going to split the complete function with its property and every method used on it. I know I will get a larger way so Edge doesn't get any problem on reading the website.

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)```

此刻一切.输出是应该从外部文件呈现网站,该外部文件具有在index.html上绘制网站的JavaScript,例如,我的意思是例如在index.html和main.js上绘制的main.js.具有调用每个独立页面和每个对应文件的连接.

Anything by the moment. The output is that the website should be rendered from an external file which has a JavaScript that is drawing the website on an index.html, what I mean is for example a main.js that is drawing at index.html and the main.js has connections to call every independent page with each corresponding file.

推荐答案

似乎散布运算符是

Seems that spread operators are 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上?它是用JavaScript开发的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆