反应过渡组未安装在ie 11中

时间:2019-03-12 00:38:07

标签: reactjs internet-explorer react-transition-group

我正在使用react-transition-group在页面加载上应用淡入过渡。不幸的是,过渡并未在11(惊喜)中进行。是否可以从中隐藏反应成分?

<Route render={({ location }) => (
                            <div>
                                <Nav />
                                <TransitionGroup>
                                    <CSSTransition
                                        key={location.key}
                                        timeout={700}
                                        classNames='fade'
                                    >
                                        <Switch location={location}>
                                            <Route exact path='/' component={Home} />
                                            <Route exact path='/skills' component={Skills} />
                                            <Route exact path='/work-history' component={WorkHistory} />
                                            <Route exact path='/projects' component={Projects} />
                                            <Route exact path='/contact' render={(props) => (
                                                <Contact {...props} onSubmit={fields => this.onSubmit(fields)}/>
                                            )}  />
                                        </Switch>
                                    </CSSTransition>
                                </TransitionGroup>
                                <Footer />
                            </div>
                        )} />
                    </ScrollToTop>
                </Router>

我的CSS:

.fade-enter {
  opacity: 0;
  z-index: 1;
  transition: opacity 700ms ease-in;
}

.fade-enter.fade-enter-active {
  opacity: 1;
  transition: opacity 700ms ease-in;
}

编辑:解决方案(如下)

更新了我的过渡CSS:

.fade-enter {
  opacity: 0;
  z-index: 1;
  transition: opacity 700ms ease-in;
}

.fade-enter.fade-enter-active {
  opacity: 1;
  transition: opacity 700ms ease-in;
}

.fade {
  opacity: 0;
  transition: opacity 4s linear;
}
.fade.in {
  opacity: 1;
}

app.js过渡组CSS过渡更改:

<TransitionGroup>
   <CSSTransition
       key={location.key}
       appear={true}
       classNames='fade'
       timeout={700}
              >

我还删除了Object.is();来自我所有JS文件的语法,因为ie11无法理解,而是使用“ if”语句。

0 个答案:

没有答案