物化芯片和图标

时间:2019-02-02 13:19:29

标签: reactjs materialize

我正在尝试使用react materialize设置标签,并且即使尝试手动设置“标签”组件,标签组件也似乎不会将“ close”类转移到图标上。 来自显示的html的图像: enter image description here

结果: enter image description here

并且该标签不可点击。

当我从控制台编辑html时,我得到了应有的Tag,可以单击它: enter image description here

我的代码是:

import React, { Component } from 'react'
import { Row, Tag, Col, Chip } from 'react-materialize'
class CreatePost extends Component {
render() {
        return (
            <div className="container">
                <form noValidate>
                    <Row>
                        <Col>
                            <Tag className="close">test tag</Tag>
                        </Col>
                    </Row>
                </form>
            </div>
        )
    }

}
<link href="http://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
 <link href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.98.0/css/materialize.min.css" rel="stylesheet">
 
  <script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.98.0/js/materialize.min.js"></script>
JSON:

{
  "name": "client",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "axios": "^0.18.0",
    "classnames": "^2.2.6",
    "jwt-decode": "^2.2.0",
    "react": "^16.7.0",
    "react-dom": "^16.7.0",
    "react-materialize": "^2.6.0",
    "react-redux": "^6.0.0",
    "react-router-dom": "^4.3.1",
    "react-scripts": "2.1.3",
    "redux": "^4.0.1",
    "redux-thunk": "^2.3.0"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "proxy": "http://localhost:5000",
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": [
    ">0.2%",
    "not dead",
    "not ie <= 11",
    "not op_mini all"
  ]
}

我在这里想念什么?

1 个答案:

答案 0 :(得分:0)

尝试使用芯片

所以 更改

   <Tag className="close">test tag</Tag>

收件人

   <Chip className="close" close={true}>
       test tag
   </Chip>