0

我在 reactjs 项目中使用来自 blueprintjs 的过滤器输入,但样式无法正确加载,这是我的代码:

Assigning.jsx

import './Assigning.scss';
export default class Assigning extends Component {
render() {
        return (
<div className="bp3-input-group modifier">
                        <span className="bp3-icon bp3-icon-filter" />
                        <input
                            type="text"
                            className="bp3-input modifier"
                            placeholder="Filter histogram..."
                        />
                    </div>
        );
    }
}

Assigning.scss

@import '~@blueprintjs/core/lib/css/blueprint.css';
@import '~@blueprintjs/icons/lib/css/blueprint-icons.css';
4

1 回答 1

0

~导入开始时需要字符吗?它适用于以下导入

import "@blueprintjs/table/lib/css/table.css";
import "@blueprintjs/icons/lib/css/blueprint-icons.css";

该组件的完整代码是

import React, { Component } from 'react';

class TestComponent extends Component {

  render() {

    return (
        <div className="bp3-input-group modifier">
        <span className="bp3-icon bp3-icon-filter" />
        <input
            type="text"
            className="bp3-input modifier"
            placeholder="Filter histogram..."
        />
    </div>
    );
  }
}

export default TestComponent;

我得到以下输出 上述示例代码的输出

于 2018-11-27T16:51:38.157 回答