Calendar is not displaying correctly using flatpickr

随声附和 提交于 2019-12-07 06:52:17

问题


I installed flatpickr by npm install flatpickr. Calender is displaying like when click on input control

var React = require('React');
var ReactDOM = require('ReactDOM');
var Flatpickr = require('flatpickr');

var Calender = React.createClass({

    componentDidMount: function(){
    this.flatpickr = new Flatpickr(this.refs.date, {dateFormat: "m/d/Y"});
    },

    render: function() {
        return(
                <div>            
                    <input data-enable-time defaultValue='2016-11-11' ref="date_from" />    
                </div>
             );
    }
});

回答1:


I know its been a long time but- You need to add the link to the CSS file.

In your SCSS file:

@import '../node_modules/flatpickr/dist/flatpickr.min.css';

It's the first line in the the docs example:
https://github.com/coderhaoxin/react-flatpickr
(When I used it I found that the css file name in the example was different than what I had, so double check that in your node_modules.)

Hope that helped.



来源:https://stackoverflow.com/questions/41004457/calendar-is-not-displaying-correctly-using-flatpickr

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!