未定义“材料化”

时间:2018-12-29 10:46:56

标签: javascript reactjs materialize

import React, { Component } from 'react';
import 'materialize-css/dist/css/materialize.min.css'
import Materialize from 'materialize-css'
import './assets/css/main.css'

import Navbar from './components/navbar'

class App extends Component {

  componentDidMount() {
    const options = [
      {
        selector: '.main-text',
        offset: 0,
        callback: function(el) {
          Materialize.fadeInImage(el)
        }
      }
    ]

    Materialize.scrollFire(options)
  }
  
  render() {
    return (
      <div>
        <Navbar />
      </div>
    );
  }
}

export default App;

我在React中添加了带有npm的实现包CSS。当我调用Materialize.scrollFire()函数时,它将显示未定义材质化。有人告诉我导入此实现的正确方法。谢谢大家...

import 'materialize-css/dist/css/materialize.min.css'
import Materialize from 'materialize-css'

class App extends Component {

  componentDidMount() {
    const options = [
      {
        selector: '.main-text',
        offset: 0,
        callback: function(el) {
          Materialize.fadeInImage(el)
        }
      }
    ]

    Materialize.scrollFire(options)
  }
 
 render() {  }

0 个答案:

没有答案