React工具箱的按钮不起作用

时间:2017-03-09 10:20:46

标签: reactjs react-toolbox

这是按钮,

enter image description here

这是我点击的按钮。

enter image description here

我不能说按钮不起作用,但与示例相比,它是如此连线:

http://react-toolbox.com/#/components/button

源代码:

import {Button} from 'react-toolbox/lib/button';

...

<Button icon='add' label='Add this' flat primary />

webpack.config.js中的加载程序:

{
        test: /react-toolbox\/.*.css/,
        use: [
          "style-loader",
          {
            loader: "css-loader",
            options: {
              modules: true,
              sourceMap: true,
              importLoaders: 1,
              localIdentName: "[name]--[local]--[hash:base64:8]"
            }
          },
          "postcss-loader" // has separate config, see postcss.config.js nearby
        ]
      },

请指教。

2 个答案:

答案 0 :(得分:0)

index.html

中加入材料图标
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">

答案 1 :(得分:0)

您只需安装以下模块即可。

https://www.npmjs.com/package/react-google-material-icons

安装

npm install react-google-material-icons

使用它

import MaterialIcon from 'react-google-material-icons'

<MaterialIcon icon="account_box" size={36}/>