特定的React代码未在IE11中呈现

时间:2017-01-15 07:40:08

标签: reactjs

我写过一个可以在Chrome和Firefox中正确呈现的小组件,但不是IE11。应用程序的主要入口点已设置IE兼容性:

doctype html
html
  head
  meta(http-equiv='X-UA-Compatible', content='IE=edge')
  title= title
  link(rel='stylesheet', href='./stylesheets/eventinfo.css')
body
block content

我的组件看起来像这样:

import React from 'react';
import { SettingsPane, SettingsPage, SettingsContent, SettingsMenu} from 'react-settings-pane';
import {Col, Form, FormGroup, FormControl, ControlLabel, HelpBlock, Button, Alert, Checkbox} from 'react-bootstrap'
import { Creatable } from 'react-select';

const Settings = React.createClass({

    render: function () {
        var data = this.props.data;
        var envFilter = data["settings.notifications.environments"] || "";
        var isChecked = this.props.data['settings.notifications.receiveMailNotifications'];

        const menu = [
            {
                title: 'Email warnings',
                url: '/settings/notifications'
            }
        ];

        // Save settings after close
        let leavePaneHandler = (wasSaved, newSettings, oldSettings) => {
            // "wasSaved" indicates wheather the pane was just closed or the save button was clicked.

            if (wasSaved) {
                var environmentsObject = newSettings["settings.notifications.environments"];
                var environments = environmentsObject.toString();
                var applications = newSettings["settings.notifications.applications"];

                this.props.onSubmit(newSettings);

            }
        };

        return (
            <SettingsPane items={menu} index="/settings/notifications" settings={data}
                          onChange={this.settingsChanged} onPaneLeave={leavePaneHandler}>
                <SettingsMenu headline="Settings"/>
                <SettingsContent header={true}>
                    <SettingsPage handler="/settings/notifications">
                        <FormGroup>
                            <Col componentClass={ControlLabel} sm={2} />
                            <Col sm={10}>
                                <label>
                                <input
                                    type="checkbox"
                                    checked={isChecked}
                                    onChange={this.props.toggleMailNotification}
                                    />
                                    Receive mail notification for these environments
                                    </label>
                            </Col>
                        </FormGroup>
                        <FormGroup>
                            <Col componentClass={ControlLabel} sm={2}>
                                <div>
                                    <label>Miljø/miljøklasse</label>
                                </div>
                            </Col>
                            <Col sm={10} className="dummy">
                                <Creatable
                                    name="settings.notifications.environments"
                                    options={this.props.options}
                                    value={envFilter}
                                    onChange={this.props.handleEnvironmentsChange}
                                    multi={true}
                                    allowCreate={true}
                                    tabSelectsValue={false}
                                    className="settings-creatable"
                                    placeholder="Enter environments"
                                />
                            </Col>
                        </FormGroup>
                    </SettingsPage>
                </SettingsContent>
            </SettingsPane>
        )
    }
});


export default Settings;

我应该如何确定导致IE11不呈现此代码的确切原因?控制台中没有错误。任何建议将被认真考虑。

1 个答案:

答案 0 :(得分:0)

感谢您的回答。我最终重写了基于react-bootstrap组件的代码,而不是调试这个。 下次我将使用评论部分提供的调试建议。